diff --git a/app/src/main/java/org/jd/gui/view/AboutView.java b/app/src/main/java/org/jd/gui/view/AboutView.java index 22b08fd7..9c5c70dd 100644 --- a/app/src/main/java/org/jd/gui/view/AboutView.java +++ b/app/src/main/java/org/jd/gui/view/AboutView.java @@ -11,8 +11,6 @@ import org.jd.gui.util.swing.SwingUtil; import javax.swing.*; -import javax.swing.border.EmptyBorder; -import javax.swing.border.LineBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; @@ -34,7 +32,7 @@ public AboutView(JFrame mainFrame) { aboutDialog.setResizable(false); JPanel panel = new JPanel(); - panel.setBorder(new EmptyBorder(15, 15, 15, 15)); + panel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); panel.setLayout(new BorderLayout()); aboutDialog.add(panel); @@ -42,14 +40,14 @@ public AboutView(JFrame mainFrame) { panel.add(vbox, BorderLayout.NORTH); JPanel subpanel = new JPanel(); vbox.add(subpanel); - subpanel.setBorder(new LineBorder(Color.BLACK)); + subpanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); subpanel.setBackground(Color.WHITE); subpanel.setLayout(new BorderLayout()); JLabel logo = new JLabel(new ImageIcon(SwingUtil.getImage("/org/jd/gui/images/jd_icon_64.png"))); - logo.setBorder(new EmptyBorder(15, 15, 15, 15)); + logo.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); subpanel.add(logo, BorderLayout.WEST); Box subvbox = Box.createVerticalBox(); - subvbox.setBorder(new EmptyBorder(15,0,15,15)); + subvbox.setBorder(BorderFactory.createEmptyBorder(15,0,15,15)); subpanel.add(subvbox, BorderLayout.EAST); Box hbox = Box.createHorizontalBox(); subvbox.add(hbox); @@ -63,7 +61,7 @@ public AboutView(JFrame mainFrame) { hbox.add(subsubpanel); subsubpanel.setLayout(new GridLayout(2,2)); subsubpanel.setOpaque(false); - subsubpanel.setBorder(new EmptyBorder(5,10,5,5)); + subsubpanel.setBorder(BorderFactory.createEmptyBorder(5,10,5,5)); String jdGuiVersion = "SNAPSHOT"; String jdCoreVersion = "SNAPSHOT"; @@ -124,13 +122,13 @@ public AboutView(JFrame mainFrame) { // Prepare to display aboutDialog.pack(); - aboutDialog.setLocationRelativeTo(mainFrame); }); } public void show() { SwingUtil.invokeLater(() -> { // Show + aboutDialog.setLocationRelativeTo(aboutDialog.getParent()); aboutDialog.setVisible(true); aboutOkButton.requestFocus(); }); diff --git a/app/src/main/java/org/jd/gui/view/GoToView.java b/app/src/main/java/org/jd/gui/view/GoToView.java index 4c8e5d9b..c6c48b55 100644 --- a/app/src/main/java/org/jd/gui/view/GoToView.java +++ b/app/src/main/java/org/jd/gui/view/GoToView.java @@ -12,7 +12,6 @@ import org.jd.gui.util.swing.SwingUtil; import javax.swing.*; -import javax.swing.border.EmptyBorder; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.*; @@ -37,7 +36,7 @@ public GoToView(Configuration configuration, JFrame mainFrame) { goToDialog.setResizable(false); Box vbox = Box.createVerticalBox(); - vbox.setBorder(new EmptyBorder(15, 15, 15, 15)); + vbox.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); goToDialog.add(vbox); // First label "Enter line number (1..xxx):" diff --git a/app/src/main/java/org/jd/gui/view/MainView.java b/app/src/main/java/org/jd/gui/view/MainView.java index 8e5fb951..b25a849b 100644 --- a/app/src/main/java/org/jd/gui/view/MainView.java +++ b/app/src/main/java/org/jd/gui/view/MainView.java @@ -19,7 +19,6 @@ import javax.swing.*; import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.text.BadLocationException; @@ -163,7 +162,7 @@ public void keyReleased(KeyEvent e) { findPreviousButton.setBorder(border); findCloseButton.setBorder(border); } else { - findPanel.setBorder(new EmptyBorder(2, 10, 2, 2)); + findPanel.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 2)); } // Actions // diff --git a/app/src/main/java/org/jd/gui/view/OpenTypeHierarchyView.java b/app/src/main/java/org/jd/gui/view/OpenTypeHierarchyView.java index dd310456..b48e4f62 100644 --- a/app/src/main/java/org/jd/gui/view/OpenTypeHierarchyView.java +++ b/app/src/main/java/org/jd/gui/view/OpenTypeHierarchyView.java @@ -18,7 +18,6 @@ import org.jd.gui.view.renderer.TreeNodeRenderer; import javax.swing.*; -import javax.swing.border.EmptyBorder; import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeExpansionListener; import javax.swing.tree.DefaultMutableTreeNode; @@ -51,7 +50,7 @@ public OpenTypeHierarchyView(API api, JFrame mainFrame, TriConsumer changedPatternCa openTypeDialog = new JDialog(mainFrame, "Open Type", false); JPanel panel = new JPanel(); - panel.setBorder(new EmptyBorder(15, 15, 15, 15)); + panel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); panel.setLayout(new BorderLayout()); openTypeDialog.add(panel); diff --git a/app/src/main/java/org/jd/gui/view/PreferencesView.java b/app/src/main/java/org/jd/gui/view/PreferencesView.java index 16badcf4..587cde6b 100644 --- a/app/src/main/java/org/jd/gui/view/PreferencesView.java +++ b/app/src/main/java/org/jd/gui/view/PreferencesView.java @@ -12,7 +12,6 @@ import org.jd.gui.util.swing.SwingUtil; import javax.swing.*; -import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; @@ -36,12 +35,14 @@ public PreferencesView(Configuration configuration, JFrame mainFrame, Collection preferencesDialog = new JDialog(mainFrame, "Preferences", false); JPanel panel = new JPanel(); - panel.setBorder(new EmptyBorder(15, 15, 15, 15)); + panel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); panel.setLayout(new BorderLayout()); preferencesDialog.add(panel); // Box for preferences panels Box preferencesPanels = Box.createVerticalBox(); + preferencesPanels.setBackground(panel.getBackground()); + preferencesPanels.setOpaque(true); Color errorBackgroundColor = Color.decode(configuration.getPreferences().get("JdGuiPreferences.errorBackgroundColor")); // Group "PreferencesPanel" by group name @@ -93,7 +94,7 @@ public PreferencesView(Configuration configuration, JFrame mainFrame, Collection JScrollPane preferencesScrollPane = new JScrollPane(preferencesPanels); preferencesScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - preferencesScrollPane.setBorder(new EmptyBorder(0, 0, 0, 0)); + preferencesScrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); panel.add(preferencesScrollPane, BorderLayout.CENTER); Box vbox = Box.createVerticalBox(); diff --git a/app/src/main/java/org/jd/gui/view/SaveAllSourcesView.java b/app/src/main/java/org/jd/gui/view/SaveAllSourcesView.java index be24077d..b35f5c07 100644 --- a/app/src/main/java/org/jd/gui/view/SaveAllSourcesView.java +++ b/app/src/main/java/org/jd/gui/view/SaveAllSourcesView.java @@ -10,13 +10,11 @@ import org.jd.gui.util.swing.SwingUtil; import javax.swing.*; -import javax.swing.border.EmptyBorder; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; -import java.util.function.IntConsumer; public class SaveAllSourcesView { protected JDialog saveAllSourcesDialog; @@ -35,7 +33,7 @@ public SaveAllSourcesView(JFrame mainFrame, Runnable cancelCallback) { }); Box vbox = Box.createVerticalBox(); - vbox.setBorder(new EmptyBorder(15, 15, 15, 15)); + vbox.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); saveAllSourcesDialog.add(vbox); // First label "Saving 'file' ..." @@ -72,7 +70,6 @@ public void actionPerformed(ActionEvent actionEvent) { // Prepare to display saveAllSourcesDialog.pack(); - saveAllSourcesDialog.setLocationRelativeTo(mainFrame); }); } @@ -85,6 +82,7 @@ public void show(File file) { saveAllSourcesProgressBar.setIndeterminate(true); saveAllSourcesDialog.pack(); // Show + saveAllSourcesDialog.setLocationRelativeTo(saveAllSourcesDialog.getParent()); saveAllSourcesDialog.setVisible(true); }); } diff --git a/app/src/main/java/org/jd/gui/view/SearchInConstantPoolsView.java b/app/src/main/java/org/jd/gui/view/SearchInConstantPoolsView.java index 4f1694b2..c54682bf 100644 --- a/app/src/main/java/org/jd/gui/view/SearchInConstantPoolsView.java +++ b/app/src/main/java/org/jd/gui/view/SearchInConstantPoolsView.java @@ -20,7 +20,6 @@ import org.jd.gui.view.renderer.TreeNodeRenderer; import javax.swing.*; -import javax.swing.border.EmptyBorder; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.TreeExpansionEvent; @@ -72,7 +71,7 @@ public SearchInConstantPoolsView( searchInConstantPoolsDialog = new JDialog(mainFrame, "Search", false); JPanel panel = new JPanel(); - panel.setBorder(new EmptyBorder(15, 15, 15, 15)); + panel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); panel.setLayout(new BorderLayout()); searchInConstantPoolsDialog.add(panel); diff --git a/app/src/main/java/org/jd/gui/view/SelectLocationView.java b/app/src/main/java/org/jd/gui/view/SelectLocationView.java index c87bd622..17aab279 100644 --- a/app/src/main/java/org/jd/gui/view/SelectLocationView.java +++ b/app/src/main/java/org/jd/gui/view/SelectLocationView.java @@ -19,8 +19,6 @@ import org.jd.gui.view.renderer.TreeNodeRenderer; import javax.swing.*; -import javax.swing.border.EmptyBorder; -import javax.swing.border.LineBorder; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; @@ -56,16 +54,16 @@ public SelectLocationView(API api, JFrame mainFrame) { Color bg = UIManager.getColor("ToolTip.background"); JPanel selectLocationPanel = new JPanel(new BorderLayout()); - selectLocationPanel.setBorder(new LineBorder(bg.darker())); + selectLocationPanel.setBorder(BorderFactory.createLineBorder(bg.darker())); selectLocationPanel.setBackground(bg); selectLocationDialog.add(selectLocationPanel); selectLocationLabel = new JLabel(); - selectLocationLabel.setBorder(new EmptyBorder(5, 5, 0, 5)); + selectLocationLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); selectLocationPanel.add(selectLocationLabel, BorderLayout.NORTH); selectLocationTree = new Tree(); - selectLocationTree.setBorder(new EmptyBorder(5, 5, 5, 5)); + selectLocationTree.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); selectLocationTree.setOpaque(false); selectLocationTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode())); selectLocationTree.setCellRenderer(new TreeNodeRenderer());