Better HiDPI, minor changes
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
005247cc0b
commit
ba53938296
12 changed files with 203 additions and 81 deletions
|
|
@ -26,6 +26,7 @@ public class AwesomeMediator {
|
||||||
private final static AwesomeMediator INSTANCE = new AwesomeMediator();
|
private final static AwesomeMediator INSTANCE = new AwesomeMediator();
|
||||||
|
|
||||||
private MainAppUi mainAppUi;
|
private MainAppUi mainAppUi;
|
||||||
|
private static int scale = Settings.INSTANCE.getScaleFactor();
|
||||||
private AwesomeMediator(){}
|
private AwesomeMediator(){}
|
||||||
|
|
||||||
public static void setMainUi(MainAppUi ui){
|
public static void setMainUi(MainAppUi ui){
|
||||||
|
|
@ -42,4 +43,15 @@ public class AwesomeMediator {
|
||||||
public static void setDestination(File folder){
|
public static void setDestination(File folder){
|
||||||
INSTANCE.mainAppUi.setDestinationDir(folder);
|
INSTANCE.mainAppUi.setDestinationDir(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getScaleValue() {
|
||||||
|
return scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void increaseScaleValue() {
|
||||||
|
AwesomeMediator.scale++;
|
||||||
|
}
|
||||||
|
public static void decreaseScaleValue() {
|
||||||
|
AwesomeMediator.scale--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2022 Dmitry Isaenko
|
Copyright 2022-2025 Dmitry Isaenko
|
||||||
|
|
||||||
This file is part of Tihwin.
|
This file is part of Tihwin.
|
||||||
|
|
||||||
|
|
@ -32,10 +32,10 @@ public class Main {
|
||||||
|
|
||||||
frame.pack();
|
frame.pack();
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
Image img = new ImageIcon(Objects.requireNonNull(MainAppUi.class.getClassLoader().getResource("tray_icon.gif"))).getImage();
|
Image img = new ImageIcon(Objects.requireNonNull(
|
||||||
|
MainAppUi.class.getClassLoader().getResource("tray_icon.gif"))).getImage();
|
||||||
frame.setIconImage(img);
|
frame.setIconImage(img);
|
||||||
frame.setMinimumSize(new Dimension(700, 350));
|
frame.setMinimumSize(new Dimension(700, 350));
|
||||||
//frame.setResizable(false);
|
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@
|
||||||
<indeterminate value="false"/>
|
<indeterminate value="false"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<grid id="a5cce" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="a5cce" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="9" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="9" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
|
@ -159,7 +159,7 @@
|
||||||
<children>
|
<children>
|
||||||
<component id="2c1c4" class="javax.swing.JLabel">
|
<component id="2c1c4" class="javax.swing.JLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<icon value="banner.png"/>
|
<icon value="banner.png"/>
|
||||||
|
|
@ -178,9 +178,9 @@
|
||||||
<html.disable class="java.lang.Boolean" value="false"/>
|
<html.disable class="java.lang.Boolean" value="false"/>
|
||||||
</clientProperties>
|
</clientProperties>
|
||||||
</component>
|
</component>
|
||||||
<grid id="b11cc" layout-manager="FlowLayout" hgap="0" vgap="0" flow-align="2">
|
<grid id="b11cc" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="0">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="5" fill="0" indent="2" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<alignmentX value="0.0"/>
|
<alignmentX value="0.0"/>
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ import javax.swing.border.Border;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
import javax.swing.text.AbstractDocument;
|
import javax.swing.text.AbstractDocument;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.*;
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Locale;
|
import java.util.*;
|
||||||
import java.util.ResourceBundle;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class MainAppUi extends JFrame {
|
public class MainAppUi extends JFrame {
|
||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
|
|
@ -61,7 +61,8 @@ public class MainAppUi extends JFrame {
|
||||||
private JButton zoomInBtn;
|
private JButton zoomInBtn;
|
||||||
private JButton zoomOutBtn;
|
private JButton zoomOutBtn;
|
||||||
private ResourceBundle resourceBundle;
|
private ResourceBundle resourceBundle;
|
||||||
int scale;
|
|
||||||
|
private List<Component> components;
|
||||||
|
|
||||||
private String recentRomLocation;
|
private String recentRomLocation;
|
||||||
private File diskImage;
|
private File diskImage;
|
||||||
|
|
@ -75,6 +76,21 @@ public class MainAppUi extends JFrame {
|
||||||
$$$setupUI$$$();
|
$$$setupUI$$$();
|
||||||
resourceBundle = ResourceBundle.getBundle("locale");
|
resourceBundle = ResourceBundle.getBundle("locale");
|
||||||
AwesomeMediator.setMainUi(this);
|
AwesomeMediator.setMainUi(this);
|
||||||
|
mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||||
|
.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_DOWN_MASK), "zoomIn");
|
||||||
|
mainPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
|
||||||
|
.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_DOWN_MASK), "zoomOut");
|
||||||
|
Action zoom = new AbstractAction() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if ("+".equals(e.getActionCommand()))
|
||||||
|
zoomIn();
|
||||||
|
else
|
||||||
|
zoomOut();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mainPanel.getActionMap().put("zoomIn", zoom);
|
||||||
|
mainPanel.getActionMap().put("zoomOut", zoom);
|
||||||
setLocationRelativeTo(null); // Set window on [kinda] center
|
setLocationRelativeTo(null); // Set window on [kinda] center
|
||||||
new FilesDropListener(mainPanel);
|
new FilesDropListener(mainPanel);
|
||||||
setContentPane(mainPanel);
|
setContentPane(mainPanel);
|
||||||
|
|
@ -100,7 +116,7 @@ public class MainAppUi extends JFrame {
|
||||||
Settings.INSTANCE.setDestination(destinationDirectoryLbl.getText());
|
Settings.INSTANCE.setDestination(destinationDirectoryLbl.getText());
|
||||||
Settings.INSTANCE.setDvdSelected(DVDRadioButton.isSelected());
|
Settings.INSTANCE.setDvdSelected(DVDRadioButton.isSelected());
|
||||||
Settings.INSTANCE.setLocale(((LocaleHolder) ulLangComboBox.getSelectedItem()).getLocaleCode());
|
Settings.INSTANCE.setLocale(((LocaleHolder) ulLangComboBox.getSelectedItem()).getLocaleCode());
|
||||||
Settings.INSTANCE.setScaleFactor(scale);
|
Settings.INSTANCE.setScaleFactor(AwesomeMediator.getScaleValue());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -114,51 +130,25 @@ public class MainAppUi extends JFrame {
|
||||||
destinationSelectBtn.addMouseListener(new TwButtonsActionListener());
|
destinationSelectBtn.addMouseListener(new TwButtonsActionListener());
|
||||||
titleField.setBorder(new LineBorder(Color.lightGray));
|
titleField.setBorder(new LineBorder(Color.lightGray));
|
||||||
|
|
||||||
scale = Settings.INSTANCE.getScaleFactor();
|
|
||||||
applyScaling();
|
applyScaling();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyScaling() {
|
private void applyScaling() {
|
||||||
if (scale == 0)
|
components = Arrays.stream(mainPanel.getComponents()).collect(Collectors.toList());
|
||||||
return;
|
components.add(statusLbl);
|
||||||
|
components.add(ulLangComboBox);
|
||||||
|
|
||||||
for (Component component : mainPanel.getComponents())
|
ScaleUi.applyInitialScale(components);
|
||||||
applyScalingOnComponent(component);
|
|
||||||
applyScalingOnComponent(statusLbl);
|
|
||||||
applyScalingOnComponent(ulLangComboBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyScalingOnComponent(Component component) {
|
|
||||||
Font defaultFont = component.getFont();
|
|
||||||
component.setFont(new Font(defaultFont.getName(), defaultFont.getStyle(), defaultFont.getSize() + scale));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void zoomIn() {
|
private void zoomIn() {
|
||||||
for (Component c : mainPanel.getComponents())
|
ScaleUi.increaseScale(components);
|
||||||
increaseElementScale(c);
|
pack();
|
||||||
increaseElementScale(statusLbl);
|
|
||||||
increaseElementScale(ulLangComboBox);
|
|
||||||
scale++;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void increaseElementScale(Component component) {
|
|
||||||
Font defaultFont = component.getFont();
|
|
||||||
component.setFont(new Font(defaultFont.getName(), defaultFont.getStyle(), defaultFont.getSize() + 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void zoomOut() {
|
private void zoomOut() {
|
||||||
if (scale == 0)
|
ScaleUi.decreaseScale(components);
|
||||||
return;
|
pack();
|
||||||
for (Component c : mainPanel.getComponents())
|
|
||||||
decreaseElementScale(c);
|
|
||||||
decreaseElementScale(statusLbl);
|
|
||||||
decreaseElementScale(ulLangComboBox);
|
|
||||||
scale--;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void decreaseElementScale(Component component) {
|
|
||||||
Font defaultFont = component.getFont();
|
|
||||||
component.setFont(new Font(defaultFont.getName(), defaultFont.getStyle(), defaultFont.getSize() - 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void diskImageSelectEventHandler() {
|
private void diskImageSelectEventHandler() {
|
||||||
|
|
@ -338,24 +328,24 @@ public class MainAppUi extends JFrame {
|
||||||
progressBar.setIndeterminate(false);
|
progressBar.setIndeterminate(false);
|
||||||
mainPanel.add(progressBar, cc.xyw(1, 12, 9, CellConstraints.FILL, CellConstraints.TOP));
|
mainPanel.add(progressBar, cc.xyw(1, 12, 9, CellConstraints.FILL, CellConstraints.TOP));
|
||||||
final JPanel panel1 = new JPanel();
|
final JPanel panel1 = new JPanel();
|
||||||
panel1.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
|
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
|
||||||
panel1.setBackground(new Color(-9251843));
|
panel1.setBackground(new Color(-9251843));
|
||||||
mainPanel.add(panel1, cc.xyw(1, 1, 9));
|
mainPanel.add(panel1, cc.xyw(1, 1, 9));
|
||||||
final JLabel label1 = new JLabel();
|
final JLabel label1 = new JLabel();
|
||||||
label1.setIcon(new ImageIcon(getClass().getResource("/banner.png")));
|
label1.setIcon(new ImageIcon(getClass().getResource("/banner.png")));
|
||||||
label1.setText("");
|
label1.setText("");
|
||||||
panel1.add(label1, new GridConstraints(0, 0, 2, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
|
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.setBackground(new Color(-9251843));
|
||||||
ulLangComboBox.setForeground(new Color(-1));
|
ulLangComboBox.setForeground(new Color(-1));
|
||||||
ulLangComboBox.putClientProperty("html.disable", Boolean.FALSE);
|
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, 1, 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));
|
||||||
final JPanel panel2 = new JPanel();
|
final JPanel panel2 = new JPanel();
|
||||||
panel2.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
panel2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
|
||||||
panel2.setAlignmentX(0.0f);
|
panel2.setAlignmentX(0.0f);
|
||||||
panel2.setAlignmentY(0.0f);
|
panel2.setAlignmentY(0.0f);
|
||||||
panel2.setFocusable(false);
|
panel2.setFocusable(false);
|
||||||
panel2.setOpaque(false);
|
panel2.setOpaque(false);
|
||||||
panel1.add(panel2, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_NORTHEAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 2, false));
|
panel1.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
|
||||||
zoomInBtn = new JButton();
|
zoomInBtn = new JButton();
|
||||||
zoomInBtn.setAlignmentY(0.0f);
|
zoomInBtn.setAlignmentY(0.0f);
|
||||||
zoomInBtn.setBorderPainted(false);
|
zoomInBtn.setBorderPainted(false);
|
||||||
|
|
|
||||||
119
src/main/java/tihwin/ScaleUi.java
Normal file
119
src/main/java/tihwin/ScaleUi.java
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
Copyright 2025 Dmitry Isaenko
|
||||||
|
|
||||||
|
This file is part of Tihwin.
|
||||||
|
|
||||||
|
Tihwin is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Tihwin is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Tihwin. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package tihwin;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static tihwin.ScaleUi.ScalePolicy.DECREASE;
|
||||||
|
import static tihwin.ScaleUi.ScalePolicy.INCREASE;
|
||||||
|
import static tihwin.ScaleUi.ScalePolicy.INIT;
|
||||||
|
|
||||||
|
public class ScaleUi {
|
||||||
|
|
||||||
|
public enum ScalePolicy {
|
||||||
|
INCREASE,
|
||||||
|
DECREASE,
|
||||||
|
INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String[] DEFAULTS = new String[] {
|
||||||
|
"Label.font",
|
||||||
|
"Button.font",
|
||||||
|
"ComboBox.font",
|
||||||
|
"TextField.font",
|
||||||
|
"List.font",
|
||||||
|
"Tree.font",
|
||||||
|
"TableHeader.font"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static void applyInitialScale(List<Component> components) {
|
||||||
|
if (AwesomeMediator.getScaleValue() == 0)
|
||||||
|
return;
|
||||||
|
for (Component component : components)
|
||||||
|
applyInitialScale(component);
|
||||||
|
applyOnDefaults(INIT);
|
||||||
|
}
|
||||||
|
public static void applyInitialScale(Component component) {
|
||||||
|
applyOn(component, AwesomeMediator.getScaleValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void increaseScale(List<Component> components) {
|
||||||
|
for (Component component : components)
|
||||||
|
increaseScale(component);
|
||||||
|
applyOnDefaults(INCREASE);
|
||||||
|
}
|
||||||
|
private static void increaseScale(Component component) {
|
||||||
|
applyOn(component, +1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void decreaseScale(List<Component> components) {
|
||||||
|
if (AwesomeMediator.getScaleValue() <= 0)
|
||||||
|
return;
|
||||||
|
for (Component component : components)
|
||||||
|
decreaseScale(component);
|
||||||
|
applyOnDefaults(DECREASE);
|
||||||
|
}
|
||||||
|
private static void decreaseScale(Component component) {
|
||||||
|
applyOn(component, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyOn(Component component, int factor) {
|
||||||
|
Font defaultFont = component.getFont();
|
||||||
|
component.setFont(new Font(defaultFont.getName(), defaultFont.getStyle(), defaultFont.getSize() + factor));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyOnDefaults(ScalePolicy policy){
|
||||||
|
switch (policy){
|
||||||
|
case INIT:
|
||||||
|
for (String defaultElement: DEFAULTS)
|
||||||
|
initDefault(defaultElement);
|
||||||
|
break;
|
||||||
|
case INCREASE:
|
||||||
|
for (String defaultElement: DEFAULTS)
|
||||||
|
increaseDefault(defaultElement);
|
||||||
|
AwesomeMediator.increaseScaleValue();
|
||||||
|
break;
|
||||||
|
case DECREASE:
|
||||||
|
for (String defaultElement: DEFAULTS)
|
||||||
|
decreaseDefault(defaultElement);
|
||||||
|
AwesomeMediator.decreaseScaleValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void initDefault(String name){
|
||||||
|
applyOnDefault(name, AwesomeMediator.getScaleValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void increaseDefault(String name){
|
||||||
|
applyOnDefault(name, +1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void decreaseDefault(String name){
|
||||||
|
applyOnDefault(name, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void applyOnDefault(String name, int factor){
|
||||||
|
Font defaultFont = UIManager.getDefaults().getFont(name);
|
||||||
|
UIManager.getDefaults().put(name, new Font(defaultFont.getName(), defaultFont.getStyle(),
|
||||||
|
defaultFont.getSize()+factor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright "2022" Dmitry Isaenko
|
Copyright "2022-2025" Dmitry Isaenko
|
||||||
|
|
||||||
This file is part of Tihwin.
|
This file is part of Tihwin.
|
||||||
|
|
||||||
|
|
@ -40,6 +40,7 @@ public class UpdateUlTableUi extends JFrame {
|
||||||
private JTable table;
|
private JTable table;
|
||||||
private UlTableModel model;
|
private UlTableModel model;
|
||||||
private JButton saveChangesBtn;
|
private JButton saveChangesBtn;
|
||||||
|
private JButton selectUlBtn;
|
||||||
|
|
||||||
private final JLabel ulLocationLbl;
|
private final JLabel ulLocationLbl;
|
||||||
private JLabel statusLbl;
|
private JLabel statusLbl;
|
||||||
|
|
@ -53,6 +54,7 @@ public class UpdateUlTableUi extends JFrame {
|
||||||
this.recentRomLocation = ulDestinationLocation;
|
this.recentRomLocation = ulDestinationLocation;
|
||||||
setupTable();
|
setupTable();
|
||||||
setupSaveButton();
|
setupSaveButton();
|
||||||
|
createSelectUlLocationButton();
|
||||||
|
|
||||||
FormLayout primaryPanelLayout = new FormLayout(
|
FormLayout primaryPanelLayout = new FormLayout(
|
||||||
"80dlu, 2dlu, fill:pref:grow",
|
"80dlu, 2dlu, fill:pref:grow",
|
||||||
|
|
@ -64,7 +66,7 @@ public class UpdateUlTableUi extends JFrame {
|
||||||
primaryPanel.add(getScrollPane(), new CellConstraints(1, 1, 3, 1,
|
primaryPanel.add(getScrollPane(), new CellConstraints(1, 1, 3, 1,
|
||||||
CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 0)));
|
CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 0, 0, 0)));
|
||||||
|
|
||||||
primaryPanel.add(getSelectUlLocationButton(), new CellConstraints(1, 2, 1, 1,
|
primaryPanel.add(selectUlBtn, new CellConstraints(1, 2, 1, 1,
|
||||||
CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(3, 3, 3, 3)));
|
CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(3, 3, 3, 3)));
|
||||||
|
|
||||||
primaryPanel.add(ulLocationLbl, new CellConstraints(3, 2, 1, 1,
|
primaryPanel.add(ulLocationLbl, new CellConstraints(3, 2, 1, 1,
|
||||||
|
|
@ -83,7 +85,8 @@ public class UpdateUlTableUi extends JFrame {
|
||||||
Image img = new ImageIcon(Objects.requireNonNull(
|
Image img = new ImageIcon(Objects.requireNonNull(
|
||||||
MainAppUi.class.getClassLoader().getResource("tray_icon.gif"))).getImage();
|
MainAppUi.class.getClassLoader().getResource("tray_icon.gif"))).getImage();
|
||||||
setIconImage(img);
|
setIconImage(img);
|
||||||
setMinimumSize(new Dimension(800, 400));
|
int scaledWidth = (int) (800 * (AwesomeMediator.getScaleValue() / 20.0 + 1));
|
||||||
|
setMinimumSize(new Dimension(scaledWidth, 500));
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
setTitle(resourceBundle.getString("ulManager"));
|
setTitle(resourceBundle.getString("ulManager"));
|
||||||
|
|
||||||
|
|
@ -119,11 +122,10 @@ public class UpdateUlTableUi extends JFrame {
|
||||||
scrollPane.setPreferredSize(new Dimension(0,50));
|
scrollPane.setPreferredSize(new Dimension(0,50));
|
||||||
return scrollPane;
|
return scrollPane;
|
||||||
}
|
}
|
||||||
private JButton getSelectUlLocationButton(){
|
private void createSelectUlLocationButton(){
|
||||||
JButton selectUlBtn = new JButton(resourceBundle.getString("ulManagerWindow_SelectUlCfgBtn"));
|
selectUlBtn = new JButton(resourceBundle.getString("ulManagerWindow_SelectUlCfgBtn"));
|
||||||
selectUlBtn.setBackground(Color.getHSBColor(0.5591398f, 0.12156863f, 1));
|
selectUlBtn.setBackground(Color.getHSBColor(0.5591398f, 0.12156863f, 1));
|
||||||
selectUlBtn.addActionListener(actionEvent -> selectUlCfgAction());
|
selectUlBtn.addActionListener(actionEvent -> selectUlCfgAction());
|
||||||
return selectUlBtn;
|
|
||||||
}
|
}
|
||||||
private JPanel getStatusPanel(){
|
private JPanel getStatusPanel(){
|
||||||
statusLbl = new JLabel();
|
statusLbl = new JLabel();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright "2022" Dmitry Isaenko
|
Copyright "2022-2025" Dmitry Isaenko
|
||||||
|
|
||||||
This file is part of Tihwin.
|
This file is part of Tihwin.
|
||||||
|
|
||||||
|
|
@ -32,8 +32,8 @@ import java.util.List;
|
||||||
|
|
||||||
public class LanguageComboBox extends JComboBox<LocaleHolder> {
|
public class LanguageComboBox extends JComboBox<LocaleHolder> {
|
||||||
private static final Color COLOR_SKY_BLUE = new Color(114, 211, 253);
|
private static final Color COLOR_SKY_BLUE = new Color(114, 211, 253);
|
||||||
private final Color COLOR_DARK = new Color(71, 81, 93);
|
private static final Color COLOR_DARK = new Color(71, 81, 93);
|
||||||
private final Border myBorder = new EmptyBorder(5, 10, 5, 10);
|
private static final Border BORDER = new EmptyBorder(5, 10, 5, 10);
|
||||||
|
|
||||||
public LanguageComboBox(){
|
public LanguageComboBox(){
|
||||||
super();
|
super();
|
||||||
|
|
@ -58,7 +58,7 @@ public class LanguageComboBox extends JComboBox<LocaleHolder> {
|
||||||
JLabel component = (JLabel) current.getListCellRendererComponent(list, localeHolder, index, isSelected, hasFocus);
|
JLabel component = (JLabel) current.getListCellRendererComponent(list, localeHolder, index, isSelected, hasFocus);
|
||||||
|
|
||||||
component.setHorizontalAlignment(SwingConstants.RIGHT);
|
component.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
component.setBorder(myBorder);
|
component.setBorder(BORDER);
|
||||||
|
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
component.setForeground(COLOR_DARK);
|
component.setForeground(COLOR_DARK);
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,7 @@ package tihwin.ui.ulupdater;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
public class UlCdDvdCellEditor extends DefaultCellEditor {
|
public class UlCdDvdCellEditor extends DefaultCellEditor {
|
||||||
static {
|
|
||||||
CD_DVD = new String[]{"CD", "DVD"};
|
|
||||||
}
|
|
||||||
private static final String[] CD_DVD;
|
|
||||||
|
|
||||||
public UlCdDvdCellEditor(){
|
public UlCdDvdCellEditor(){
|
||||||
super(new JComboBox<>(CD_DVD));
|
super(new JComboBox<>(new String[]{"CD", "DVD"}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright "2022" Dmitry Isaenko
|
Copyright "2022-2025" Dmitry Isaenko
|
||||||
|
|
||||||
This file is part of Tihwin.
|
This file is part of Tihwin.
|
||||||
|
|
||||||
|
|
@ -38,27 +38,27 @@ public class UlTableColumnModel extends DefaultTableColumnModel {
|
||||||
|
|
||||||
getColumn(0).setMinWidth(20);
|
getColumn(0).setMinWidth(20);
|
||||||
getColumn(0).setPreferredWidth(25);
|
getColumn(0).setPreferredWidth(25);
|
||||||
getColumn(0).setMaxWidth(50);
|
//getColumn(0).setMaxWidth(50);
|
||||||
|
|
||||||
getColumn(1).setMinWidth(200);
|
getColumn(1).setMinWidth(200);
|
||||||
getColumn(1).setPreferredWidth(230);
|
getColumn(1).setPreferredWidth(230);
|
||||||
getColumn(1).setMaxWidth(300);
|
//getColumn(1).setMaxWidth(300);
|
||||||
|
|
||||||
getColumn(2).setMinWidth(100);
|
getColumn(2).setMinWidth(100);
|
||||||
getColumn(2).setPreferredWidth(135);
|
getColumn(2).setPreferredWidth(135);
|
||||||
getColumn(2).setMaxWidth(150);
|
//getColumn(2).setMaxWidth(150);
|
||||||
|
|
||||||
getColumn(3).setMinWidth(75);
|
getColumn(3).setMinWidth(75);
|
||||||
getColumn(3).setPreferredWidth(100);
|
getColumn(3).setPreferredWidth(100);
|
||||||
getColumn(3).setMaxWidth(125);
|
//getColumn(3).setMaxWidth(125);
|
||||||
|
|
||||||
getColumn(4).setMinWidth(50);
|
getColumn(4).setMinWidth(50);
|
||||||
getColumn(4).setPreferredWidth(75);
|
getColumn(4).setPreferredWidth(75);
|
||||||
getColumn(4).setMaxWidth(100);
|
//getColumn(4).setMaxWidth(100);
|
||||||
|
|
||||||
getColumn(5).setMinWidth(100);
|
getColumn(5).setMinWidth(100);
|
||||||
getColumn(5).setPreferredWidth(135);
|
getColumn(5).setPreferredWidth(135);
|
||||||
getColumn(5).setMaxWidth(150);
|
//getColumn(5).setMaxWidth(150);
|
||||||
|
|
||||||
JTextField textField = new JTextField();
|
JTextField textField = new JTextField();
|
||||||
((AbstractDocument) textField.getDocument()).setDocumentFilter(new TitleFieldFilter());
|
((AbstractDocument) textField.getDocument()).setDocumentFilter(new TitleFieldFilter());
|
||||||
|
|
@ -69,7 +69,6 @@ public class UlTableColumnModel extends DefaultTableColumnModel {
|
||||||
getColumn(5).setCellEditor(new UlButtonCellEditor());
|
getColumn(5).setCellEditor(new UlButtonCellEditor());
|
||||||
|
|
||||||
setColumnSelectionAllowed(false);
|
setColumnSelectionAllowed(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright "2022" Dmitry Isaenko
|
Copyright "2022-2025" Dmitry Isaenko
|
||||||
|
|
||||||
This file is part of Tihwin.
|
This file is part of Tihwin.
|
||||||
|
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
*/
|
*/
|
||||||
package tihwin.ui.ulupdater;
|
package tihwin.ui.ulupdater;
|
||||||
|
|
||||||
|
import tihwin.ScaleUi;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
@ -34,6 +36,7 @@ public class UlTableContentJLabelRenderer extends DefaultTableCellRenderer {
|
||||||
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||||
label.setBackground(Color.getHSBColor(0, 0, 0.9411765f));
|
label.setBackground(Color.getHSBColor(0, 0, 0.9411765f));
|
||||||
label.setBorder(new EmptyBorder(0, 3, 0, 3));
|
label.setBorder(new EmptyBorder(0, 3, 0, 3));
|
||||||
|
ScaleUi.applyInitialScale(label);
|
||||||
switch (column){
|
switch (column){
|
||||||
case 0:
|
case 0:
|
||||||
case 3:
|
case 3:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright "2022" Dmitry Isaenko
|
Copyright "2022-2025" Dmitry Isaenko
|
||||||
|
|
||||||
This file is part of Tihwin.
|
This file is part of Tihwin.
|
||||||
|
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
*/
|
*/
|
||||||
package tihwin.ui.ulupdater;
|
package tihwin.ui.ulupdater;
|
||||||
|
|
||||||
|
import tihwin.AwesomeMediator;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
@ -29,11 +31,11 @@ public class UlTableHeaderRenderer extends DefaultTableCellRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||||
boolean isSelected, boolean hasFocus,
|
boolean isSelected, boolean hasFocus,
|
||||||
int row, int column){
|
int row, int column){
|
||||||
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||||
Font font = label.getFont();
|
Font font = label.getFont();
|
||||||
label.setFont(new Font(font.getFontName(), Font.BOLD, font.getSize()));
|
label.setFont(new Font(font.getFontName(), Font.BOLD, font.getSize()+ AwesomeMediator.getScaleValue()));
|
||||||
label.setBorder(new LineBorder(Color.darkGray));
|
label.setBorder(new LineBorder(Color.darkGray));
|
||||||
label.setHorizontalAlignment(SwingConstants.CENTER);
|
label.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
label.setBackground(Color.getHSBColor(0.33333334f, 0.12765957f, 0.92156863f));
|
label.setBackground(Color.getHSBColor(0.33333334f, 0.12765957f, 0.92156863f));
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ InterruptedAndFilesDeletedText = Tugas terhenti dan berkas pecahan telah dihapus
|
||||||
InterruptedAndFilesNotDeletedText = Tugas terhenti dan berkas pecahan TIDAK dihapus
|
InterruptedAndFilesNotDeletedText = Tugas terhenti dan berkas pecahan TIDAK dihapus
|
||||||
InterruptedText = Terhenti
|
InterruptedText = Terhenti
|
||||||
isoFilesText = Berkas ISO
|
isoFilesText = Berkas ISO
|
||||||
WelcomeText = Selamat datang! Saya Tihwin: utilitas format ul untuk PS2 Anda! GPLv3+, 2022\u00E2\u0080\u00932025, Dmitry Isaenko
|
WelcomeText = Selamat datang! Saya Tihwin: utilitas format ul untuk PS2 Anda! GPLv3+, 2022-2025, Dmitry Isaenko
|
||||||
SelectBtn = Pilih
|
SelectBtn = Pilih
|
||||||
SelectDiskImageText = Pilih citra disk
|
SelectDiskImageText = Pilih citra disk
|
||||||
SetDestinationDirectoryText = Pilih direktori tujuan
|
SetDestinationDirectoryText = Pilih direktori tujuan
|
||||||
Loading…
Reference in a new issue