-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add option in preferences to launch the carousel preview in wind…
…owed or fullscreen mode
- Loading branch information
1 parent
f4ebfb5
commit 5164188
Showing
7 changed files
with
173 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/main/java/se/lantz/gui/preferences/CarouselPreviewPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package se.lantz.gui.preferences; | ||
|
||
import java.awt.GridBagConstraints; | ||
import java.awt.GridBagLayout; | ||
import java.beans.Beans; | ||
|
||
import javax.swing.JCheckBox; | ||
import javax.swing.JPanel; | ||
|
||
import se.lantz.model.PreferencesModel; | ||
import java.awt.Insets; | ||
|
||
public class CarouselPreviewPanel extends JPanel | ||
{ | ||
private JCheckBox fullscreenCheckBox; | ||
private PreferencesModel model; | ||
|
||
public CarouselPreviewPanel(PreferencesModel model) | ||
{ | ||
this.model = model; | ||
GridBagLayout gridBagLayout = new GridBagLayout(); | ||
setLayout(gridBagLayout); | ||
GridBagConstraints gbc_fullscreenCheckBox = new GridBagConstraints(); | ||
gbc_fullscreenCheckBox.insets = new Insets(5, 0, 5, 5); | ||
gbc_fullscreenCheckBox.weighty = 1.0; | ||
gbc_fullscreenCheckBox.weightx = 1.0; | ||
gbc_fullscreenCheckBox.anchor = GridBagConstraints.NORTHWEST; | ||
gbc_fullscreenCheckBox.gridx = 0; | ||
gbc_fullscreenCheckBox.gridy = 0; | ||
add(getFullscreenCheckBox(), gbc_fullscreenCheckBox); | ||
if (!Beans.isDesignTime()) | ||
{ | ||
model.addPropertyChangeListener(e -> modelChanged()); | ||
//Trigger an initial read from the model | ||
modelChanged(); | ||
} | ||
} | ||
|
||
private void modelChanged() | ||
{ | ||
getFullscreenCheckBox().setSelected(model.isStartCarouselInFullscreen()); | ||
} | ||
|
||
private JCheckBox getFullscreenCheckBox() | ||
{ | ||
if (fullscreenCheckBox == null) | ||
{ | ||
fullscreenCheckBox = new JCheckBox("Launch Carousel Preview dialog in fullscreen mode."); | ||
fullscreenCheckBox | ||
.addItemListener((e) -> model.setStartCarouselInFullscreen(fullscreenCheckBox.isSelected())); | ||
} | ||
return fullscreenCheckBox; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters