diff --git a/src/main/java/tihwin/Main.java b/src/main/java/tihwin/Main.java index 926dbce..afdccbe 100644 --- a/src/main/java/tihwin/Main.java +++ b/src/main/java/tihwin/Main.java @@ -34,7 +34,7 @@ public class Main { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Image img = new ImageIcon(Objects.requireNonNull(MainAppUi.class.getClassLoader().getResource("tray_icon.gif"))).getImage(); frame.setIconImage(img); - frame.setMinimumSize(new Dimension(700, 300)); + frame.setMinimumSize(new Dimension(700, 350)); //frame.setResizable(false); frame.setVisible(true); } diff --git a/src/main/java/tihwin/MainAppUi.form b/src/main/java/tihwin/MainAppUi.form index ec0e66f..58f8882 100644 --- a/src/main/java/tihwin/MainAppUi.form +++ b/src/main/java/tihwin/MainAppUi.form @@ -2,6 +2,7 @@
+ @@ -10,9 +11,10 @@ - + + @@ -23,14 +25,14 @@ - + - + @@ -40,7 +42,7 @@ - + @@ -49,7 +51,7 @@ - + @@ -58,7 +60,7 @@ - + @@ -67,7 +69,7 @@ - + @@ -77,7 +79,7 @@ - + @@ -86,7 +88,7 @@ - + @@ -95,7 +97,7 @@ - + @@ -104,7 +106,7 @@ - + @@ -113,7 +115,7 @@ - + @@ -123,7 +125,7 @@ - + @@ -133,37 +135,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + - + @@ -189,9 +168,12 @@ - + - + + + + @@ -200,7 +182,7 @@ - + @@ -211,6 +193,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/tihwin/MainAppUi.java b/src/main/java/tihwin/MainAppUi.java index 5ba79de..cfeada1 100644 --- a/src/main/java/tihwin/MainAppUi.java +++ b/src/main/java/tihwin/MainAppUi.java @@ -88,7 +88,7 @@ public class MainAppUi extends JFrame { CDRadioButton.setSelected(true); recentRomLocation = Settings.INSTANCE.getRomLocation(); destinationDirectoryLbl.setText(FilesHelper.getRealFolder(Settings.INSTANCE.getDestination())); - addWindowListener(new WindowAdapter(){ + addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent windowEvent) { Settings.INSTANCE.setRomLocation(recentRomLocation); @@ -110,14 +110,14 @@ public class MainAppUi extends JFrame { } private void diskImageSelectEventHandler() { - JFileChooser fileChooser = new JFileChooser(FilesHelper.getRealFolder(recentRomLocation)); - fileChooser.setDialogTitle(resourceBundle.getString("SelectDiskImageText")); - fileChooser.setFileFilter(new IsoFileFilter()); - if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) - setDiskImageFile(fileChooser.getSelectedFile()); + JFileChooser fileChooser = new JFileChooser(FilesHelper.getRealFolder(recentRomLocation)); + fileChooser.setDialogTitle(resourceBundle.getString("SelectDiskImageText")); + fileChooser.setFileFilter(new IsoFileFilter()); + if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) + setDiskImageFile(fileChooser.getSelectedFile()); } - public void setDiskImageFile(File imageFile){ + public void setDiskImageFile(File imageFile) { try { recentRomLocation = imageFile.getParent(); ISO9660 iso9660 = new ISO9660(imageFile); @@ -227,6 +227,11 @@ public class MainAppUi extends JFrame { ulCfgBtn.setText(resourceBundle.getString("editUlCfgBtn")); } + private void createUIComponents() { + this.ulLangComboBox = new LanguageComboBox(); + ulLangComboBox.addActionListener(e -> onLanguageChanged()); + } + /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< @@ -237,56 +242,49 @@ public class MainAppUi extends JFrame { private void $$$setupUI$$$() { createUIComponents(); mainPanel = new JPanel(); - mainPanel.setLayout(new FormLayout("fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,fill:max(d;4px):noGrow,fill:d:grow,left:4dlu:noGrow,fill:p:noGrow", "center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:p:grow,top:4dlu:noGrow,center:max(d;4px):noGrow")); + mainPanel.setLayout(new FormLayout("fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,left:4dlu:noGrow,fill:p:noGrow,fill:max(d;4px):noGrow,fill:d:grow,left:4dlu:noGrow,fill:p:noGrow", "center:max(d;4px):noGrow,top:m:grow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;1dlu):noGrow")); diskImageSelectBtn = new JButton(); diskImageSelectBtn.setBackground(new Color(-2034433)); this.$$$loadButtonText$$$(diskImageSelectBtn, this.$$$getMessageFromBundle$$$("locale", "SelectBtn")); CellConstraints cc = new CellConstraints(); - mainPanel.add(diskImageSelectBtn, new CellConstraints(1, 3, 3, 1, CellConstraints.DEFAULT, CellConstraints.CENTER, new Insets(0, 5, 0, 0))); + mainPanel.add(diskImageSelectBtn, new CellConstraints(1, 4, 3, 1, CellConstraints.DEFAULT, CellConstraints.CENTER, new Insets(0, 5, 0, 0))); titleField = new JTextField(); - mainPanel.add(titleField, new CellConstraints(7, 5, 3, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5))); + mainPanel.add(titleField, new CellConstraints(7, 6, 3, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5))); destinationDirectoryLbl = new JLabel(); destinationDirectoryLbl.setText(""); - mainPanel.add(destinationDirectoryLbl, cc.xyw(7, 7, 3)); + mainPanel.add(destinationDirectoryLbl, cc.xyw(7, 8, 3)); diskImageNameLbl = new JLabel(); diskImageNameLbl.setText(""); - mainPanel.add(diskImageNameLbl, cc.xy(7, 3)); + mainPanel.add(diskImageNameLbl, cc.xy(7, 4)); destinationSelectBtn = new JButton(); destinationSelectBtn.setBackground(new Color(-2034433)); this.$$$loadButtonText$$$(destinationSelectBtn, this.$$$getMessageFromBundle$$$("locale", "SelectBtn")); - mainPanel.add(destinationSelectBtn, new CellConstraints(1, 7, 3, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0))); + mainPanel.add(destinationSelectBtn, new CellConstraints(1, 8, 3, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0))); ulDestinationRoLbl = new JLabel(); this.$$$loadLabelText$$$(ulDestinationRoLbl, this.$$$getMessageFromBundle$$$("locale", "ulDestinationLbl")); - mainPanel.add(ulDestinationRoLbl, cc.xy(5, 7)); + mainPanel.add(ulDestinationRoLbl, cc.xy(5, 8)); diskImageRoLbl = new JLabel(); this.$$$loadLabelText$$$(diskImageRoLbl, this.$$$getMessageFromBundle$$$("locale", "DiskImageLbl")); - mainPanel.add(diskImageRoLbl, cc.xy(5, 3)); + mainPanel.add(diskImageRoLbl, cc.xy(5, 4)); titleRoLbl = new JLabel(); this.$$$loadLabelText$$$(titleRoLbl, this.$$$getMessageFromBundle$$$("locale", "TitleLbl")); - mainPanel.add(titleRoLbl, cc.xy(5, 5)); + mainPanel.add(titleRoLbl, cc.xy(5, 6)); CDRadioButton = new JRadioButton(); this.$$$loadButtonText$$$(CDRadioButton, this.$$$getMessageFromBundle$$$("locale", "CD")); - mainPanel.add(CDRadioButton, cc.xy(1, 5)); + mainPanel.add(CDRadioButton, cc.xy(1, 6)); DVDRadioButton = new JRadioButton(); DVDRadioButton.setSelected(true); this.$$$loadButtonText$$$(DVDRadioButton, this.$$$getMessageFromBundle$$$("locale", "DVD")); - mainPanel.add(DVDRadioButton, cc.xy(3, 5)); + mainPanel.add(DVDRadioButton, cc.xy(3, 6)); convertBtn = new JButton(); convertBtn.setBackground(new Color(-2034433)); this.$$$loadButtonText$$$(convertBtn, this.$$$getMessageFromBundle$$$("locale", "ConvertBtn")); - mainPanel.add(convertBtn, new CellConstraints(1, 9, 9, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 5))); - statusJPanel = new JPanel(); - statusJPanel.setLayout(new GridLayoutManager(1, 1, new Insets(5, 5, 5, 5), -1, -1)); - statusJPanel.setBackground(new Color(-1)); - mainPanel.add(statusJPanel, cc.xyw(1, 12, 9)); - statusLbl = new JLabel(); - this.$$$loadLabelText$$$(statusLbl, this.$$$getMessageFromBundle$$$("locale", "WelcomeText")); - statusJPanel.add(statusLbl, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + mainPanel.add(convertBtn, new CellConstraints(1, 10, 9, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 5))); progressBar = new JProgressBar(); progressBar.setBorderPainted(false); - progressBar.setForeground(new Color(-9251843)); + progressBar.setForeground(new Color(-26368)); progressBar.setIndeterminate(false); - mainPanel.add(progressBar, cc.xyw(1, 11, 7, CellConstraints.FILL, CellConstraints.DEFAULT)); + mainPanel.add(progressBar, cc.xyw(1, 12, 9, CellConstraints.FILL, CellConstraints.TOP)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); panel1.setBackground(new Color(-9251843)); @@ -295,15 +293,24 @@ public class MainAppUi extends JFrame { label1.setIcon(new ImageIcon(getClass().getResource("/banner.png"))); label1.setText(""); panel1.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + ulLangComboBox.setBackground(new Color(-9251843)); + ulLangComboBox.setForeground(new Color(-1)); ulLangComboBox.putClientProperty("html.disable", Boolean.FALSE); - panel1.add(ulLangComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel1.add(ulLangComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); ulCfgBtn = new JButton(); ulCfgBtn.setBackground(new Color(-2031648)); ulCfgBtn.setMargin(new Insets(1, 1, 1, 1)); ulCfgBtn.setMinimumSize(new Dimension(130, 30)); ulCfgBtn.setPreferredSize(new Dimension(140, 30)); this.$$$loadButtonText$$$(ulCfgBtn, this.$$$getMessageFromBundle$$$("locale", "editUlCfgBtn")); - mainPanel.add(ulCfgBtn, new CellConstraints(9, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5))); + mainPanel.add(ulCfgBtn, new CellConstraints(9, 4, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5))); + statusJPanel = new JPanel(); + statusJPanel.setLayout(new GridLayoutManager(1, 1, new Insets(5, 5, 5, 5), -1, -1)); + statusJPanel.setBackground(new Color(-1)); + mainPanel.add(statusJPanel, cc.xyw(1, 14, 9)); + statusLbl = new JLabel(); + this.$$$loadLabelText$$$(statusLbl, this.$$$getMessageFromBundle$$$("locale", "WelcomeText")); + statusJPanel.add(statusLbl, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); ButtonGroup buttonGroup; buttonGroup = new ButtonGroup(); buttonGroup.add(DVDRadioButton); @@ -388,8 +395,4 @@ public class MainAppUi extends JFrame { return mainPanel; } - private void createUIComponents() { - this.ulLangComboBox = new LanguageComboBox(); - ulLangComboBox.addActionListener(e -> onLanguageChanged()); - } } diff --git a/src/main/java/tihwin/ui/LanguageComboBox.java b/src/main/java/tihwin/ui/LanguageComboBox.java index 2726ba5..e70126a 100644 --- a/src/main/java/tihwin/ui/LanguageComboBox.java +++ b/src/main/java/tihwin/ui/LanguageComboBox.java @@ -24,17 +24,21 @@ import tihwin.ui.model.LocaleHolder; import tihwin.ui.model.SettingsLanguagesSetup; import javax.swing.*; +import javax.swing.border.Border; +import javax.swing.border.EmptyBorder; import javax.swing.plaf.basic.BasicComboBoxUI; import java.awt.*; import java.util.List; public class LanguageComboBox extends JComboBox { private static final Color COLOR_SKY_BLUE = new Color(114, 211, 253); + private final Color COLOR_DARK = new Color(71, 81, 93); + private final Border myBorder = new EmptyBorder(5, 10, 5, 10); public LanguageComboBox(){ super(); - UIManager.put("ComboBox.selectionForeground", COLOR_SKY_BLUE); - UIManager.put("ComboBox.selectionBackground", Color.white); + UIManager.put("ComboBox.selectionForeground", COLOR_DARK); + UIManager.put("ComboBox.selectionBackground", COLOR_SKY_BLUE); UIManager.put("ComboBox.squareButton", Boolean.FALSE); setUI(new BasicComboBoxUI(){ @@ -51,14 +55,17 @@ public class LanguageComboBox extends JComboBox { ListCellRenderer current = (ListCellRenderer) getRenderer(); setRenderer((list, localeHolder, index, isSelected, hasFocus) -> { - Component component = current.getListCellRendererComponent(list, localeHolder, index, isSelected, hasFocus); + JLabel component = (JLabel) current.getListCellRendererComponent(list, localeHolder, index, isSelected, hasFocus); + + component.setHorizontalAlignment(SwingConstants.RIGHT); + component.setBorder(myBorder); if (isSelected) { - component.setForeground(Color.black); + component.setForeground(COLOR_DARK); component.setBackground(Color.ORANGE); } else { component.setForeground(Color.white); - component.setBackground(COLOR_SKY_BLUE); + component.setBackground(COLOR_DARK); } return component; }); diff --git a/src/main/java/tihwin/ui/UiUpdater.java b/src/main/java/tihwin/ui/UiUpdater.java index 68cff2b..a92c702 100644 --- a/src/main/java/tihwin/ui/UiUpdater.java +++ b/src/main/java/tihwin/ui/UiUpdater.java @@ -32,6 +32,7 @@ public class UiUpdater { this.progressBar = progressBar; this.statusLine = statusLine; progressBar.setMaximum(100); + progressBar.setStringPainted(true); } public synchronized void updateProgressBySize(int value){ @@ -49,6 +50,7 @@ public class UiUpdater { public void close(){ progressBar.setValue(0); + progressBar.setStringPainted(false); AwesomeMediator.notifyAllConvertsEnded(); } }