diff options
| author | 2020-07-18 13:38:32 +0200 | |
|---|---|---|
| committer | 2020-07-18 13:38:32 +0200 | |
| commit | bab3b02a992e93049fb8c06a332c2f89c12f7e92 (patch) | |
| tree | c0ec17d05a8eaac619fd877b8957fc1ab77eeddc /enigma-swing/src/main/java/cuchaz | |
| parent | Add GridBagConstraintsBuilder from feature/settings-dialog branch (diff) | |
| download | enigma-bab3b02a992e93049fb8c06a332c2f89c12f7e92.tar.gz enigma-bab3b02a992e93049fb8c06a332c2f89c12f7e92.tar.xz enigma-bab3b02a992e93049fb8c06a332c2f89c12f7e92.zip | |
Replace usages of GridBagConstraints with GridBagConstraintsBuilder
Diffstat (limited to 'enigma-swing/src/main/java/cuchaz')
4 files changed, 39 insertions, 119 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/AbstractDialog.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/AbstractDialog.java index b179eac1..57f7f948 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/AbstractDialog.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/AbstractDialog.java | |||
| @@ -8,6 +8,7 @@ import javax.swing.JDialog; | |||
| 8 | import javax.swing.JLabel; | 8 | import javax.swing.JLabel; |
| 9 | import javax.swing.JPanel; | 9 | import javax.swing.JPanel; |
| 10 | 10 | ||
| 11 | import cuchaz.enigma.gui.util.GridBagConstraintsBuilder; | ||
| 11 | import cuchaz.enigma.gui.util.ScaleUtil; | 12 | import cuchaz.enigma.gui.util.ScaleUtil; |
| 12 | import cuchaz.enigma.utils.I18n; | 13 | import cuchaz.enigma.utils.I18n; |
| 13 | import cuchaz.enigma.utils.Pair; | 14 | import cuchaz.enigma.utils.Pair; |
| @@ -25,8 +26,6 @@ public abstract class AbstractDialog extends JDialog { | |||
| 25 | Container contentPane = getContentPane(); | 26 | Container contentPane = getContentPane(); |
| 26 | contentPane.setLayout(new BorderLayout()); | 27 | contentPane.setLayout(new BorderLayout()); |
| 27 | Container inputContainer = new JPanel(new GridBagLayout()); | 28 | Container inputContainer = new JPanel(new GridBagLayout()); |
| 28 | GridBagConstraints c = new GridBagConstraints(); | ||
| 29 | |||
| 30 | List<Pair<String, Component>> components = createComponents(); | 29 | List<Pair<String, Component>> components = createComponents(); |
| 31 | 30 | ||
| 32 | for (int i = 0; i < components.size(); i += 1) { | 31 | for (int i = 0; i < components.size(); i += 1) { |
| @@ -34,20 +33,10 @@ public abstract class AbstractDialog extends JDialog { | |||
| 34 | JLabel label = new JLabel(I18n.translate(entry.a)); | 33 | JLabel label = new JLabel(I18n.translate(entry.a)); |
| 35 | Component component = entry.b; | 34 | Component component = entry.b; |
| 36 | 35 | ||
| 37 | c.gridy = i; | 36 | GridBagConstraintsBuilder cb = GridBagConstraintsBuilder.create().insets(4); |
| 38 | c.insets = ScaleUtil.getInsets(4, 4, 4, 4); | ||
| 39 | |||
| 40 | c.gridx = 0; | ||
| 41 | c.weightx = 0.0; | ||
| 42 | c.anchor = GridBagConstraints.LINE_END; | ||
| 43 | c.fill = GridBagConstraints.NONE; | ||
| 44 | inputContainer.add(label, c); | ||
| 45 | 37 | ||
| 46 | c.gridx = 1; | 38 | inputContainer.add(label, cb.pos(0, i).weightX(0.0).anchor(GridBagConstraints.LINE_END).fill(GridBagConstraints.NONE).build()); |
| 47 | c.weightx = 1.0; | 39 | inputContainer.add(component, cb.pos(1, i).weightX(1.0).anchor(GridBagConstraints.LINE_END).fill(GridBagConstraints.HORIZONTAL).build()); |
| 48 | c.anchor = GridBagConstraints.LINE_START; | ||
| 49 | c.fill = GridBagConstraints.HORIZONTAL; | ||
| 50 | inputContainer.add(component, c); | ||
| 51 | } | 40 | } |
| 52 | contentPane.add(inputContainer, BorderLayout.CENTER); | 41 | contentPane.add(inputContainer, BorderLayout.CENTER); |
| 53 | Container buttonContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, ScaleUtil.scale(4), ScaleUtil.scale(4))); | 42 | Container buttonContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, ScaleUtil.scale(4), ScaleUtil.scale(4))); |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/StatsDialog.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/StatsDialog.java index c691d753..1e81a169 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/StatsDialog.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/StatsDialog.java | |||
| @@ -4,26 +4,16 @@ import java.awt.Container; | |||
| 4 | import java.awt.Dimension; | 4 | import java.awt.Dimension; |
| 5 | import java.awt.GridBagConstraints; | 5 | import java.awt.GridBagConstraints; |
| 6 | import java.awt.GridBagLayout; | 6 | import java.awt.GridBagLayout; |
| 7 | import java.util.Collections; | 7 | import java.util.*; |
| 8 | import java.util.HashMap; | ||
| 9 | import java.util.Locale; | ||
| 10 | import java.util.Map; | ||
| 11 | import java.util.Set; | ||
| 12 | import java.util.stream.Collectors; | 8 | import java.util.stream.Collectors; |
| 13 | 9 | ||
| 14 | import javax.swing.JButton; | 10 | import javax.swing.*; |
| 15 | import javax.swing.JCheckBox; | ||
| 16 | import javax.swing.JDialog; | ||
| 17 | import javax.swing.JFrame; | ||
| 18 | import javax.swing.JLabel; | ||
| 19 | import javax.swing.JPanel; | ||
| 20 | import javax.swing.JTextField; | ||
| 21 | import javax.swing.SwingUtilities; | ||
| 22 | 11 | ||
| 23 | import cuchaz.enigma.gui.Gui; | 12 | import cuchaz.enigma.gui.Gui; |
| 24 | import cuchaz.enigma.gui.stats.StatsGenerator; | 13 | import cuchaz.enigma.gui.stats.StatsGenerator; |
| 25 | import cuchaz.enigma.gui.stats.StatsMember; | 14 | import cuchaz.enigma.gui.stats.StatsMember; |
| 26 | import cuchaz.enigma.gui.stats.StatsResult; | 15 | import cuchaz.enigma.gui.stats.StatsResult; |
| 16 | import cuchaz.enigma.gui.util.GridBagConstraintsBuilder; | ||
| 27 | import cuchaz.enigma.gui.util.ScaleUtil; | 17 | import cuchaz.enigma.gui.util.ScaleUtil; |
| 28 | import cuchaz.enigma.utils.I18n; | 18 | import cuchaz.enigma.utils.I18n; |
| 29 | 19 | ||
| @@ -46,59 +36,37 @@ public class StatsDialog { | |||
| 46 | Container contentPane = dialog.getContentPane(); | 36 | Container contentPane = dialog.getContentPane(); |
| 47 | contentPane.setLayout(new GridBagLayout()); | 37 | contentPane.setLayout(new GridBagLayout()); |
| 48 | 38 | ||
| 49 | GridBagConstraints c = new GridBagConstraints(); | 39 | GridBagConstraintsBuilder cb = GridBagConstraintsBuilder.create().insets(4); |
| 50 | c.insets = ScaleUtil.getInsets(4, 4, 4, 4); | ||
| 51 | c.gridy = 0; | ||
| 52 | 40 | ||
| 53 | Map<StatsMember, JCheckBox> checkboxes = new HashMap<>(); | 41 | Map<StatsMember, JCheckBox> checkboxes = new HashMap<>(); |
| 54 | 42 | ||
| 43 | int[] i = {0}; | ||
| 55 | results.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(e -> { | 44 | results.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(e -> { |
| 56 | StatsMember m = e.getKey(); | 45 | StatsMember m = e.getKey(); |
| 57 | StatsResult result = e.getValue(); | 46 | StatsResult result = e.getValue(); |
| 58 | 47 | ||
| 59 | c.gridx = 0; | ||
| 60 | c.weightx = 1.0; | ||
| 61 | c.anchor = GridBagConstraints.WEST; | ||
| 62 | JCheckBox checkBox = new JCheckBox(I18n.translate("type." + m.name().toLowerCase(Locale.ROOT))); | 48 | JCheckBox checkBox = new JCheckBox(I18n.translate("type." + m.name().toLowerCase(Locale.ROOT))); |
| 63 | checkboxes.put(m, checkBox); | 49 | checkboxes.put(m, checkBox); |
| 64 | contentPane.add(checkBox, c); | 50 | contentPane.add(checkBox, cb.pos(0, i[0]).weightX(1.0).anchor(GridBagConstraints.WEST).build()); |
| 65 | 51 | ||
| 66 | c.gridx = 1; | 52 | GridBagConstraintsBuilder labels = cb.anchor(GridBagConstraints.EAST); |
| 67 | c.weightx = 0.0; | ||
| 68 | c.anchor = GridBagConstraints.EAST; | ||
| 69 | contentPane.add(new JLabel(Integer.toString(result.getMapped())), c); | ||
| 70 | 53 | ||
| 71 | c.gridx = 2; | 54 | contentPane.add(new JLabel(Integer.toString(result.getMapped())), labels.pos(1, i[0]).build()); |
| 72 | contentPane.add(new JLabel("/"), c); | 55 | contentPane.add(new JLabel("/"), labels.pos(2, i[0]).build()); |
| 56 | contentPane.add(new JLabel(Integer.toString(result.getTotal())), labels.pos(3, i[0]).build()); | ||
| 57 | contentPane.add(new JLabel(String.format("%.2f%%", result.getPercentage())), labels.pos(4, i[0]).build()); | ||
| 73 | 58 | ||
| 74 | c.gridx = 3; | 59 | i[0]++; |
| 75 | contentPane.add(new JLabel(Integer.toString(result.getTotal())), c); | ||
| 76 | |||
| 77 | c.gridx = 4; | ||
| 78 | contentPane.add(new JLabel(String.format("%.2f%%", result.getPercentage())), c); | ||
| 79 | |||
| 80 | c.gridy += 1; | ||
| 81 | }); | 60 | }); |
| 82 | 61 | ||
| 83 | c.gridx = 0; | 62 | GridBagConstraintsBuilder cb1 = cb.pos(0, 0).width(5).weightX(1.0).anchor(GridBagConstraints.WEST); |
| 84 | c.gridwidth = 5; | ||
| 85 | c.weightx = 1.0; | ||
| 86 | c.anchor = GridBagConstraints.WEST; | ||
| 87 | 63 | ||
| 88 | // show top-level package option | 64 | // show top-level package option |
| 89 | JLabel topLevelPackageOption = new JLabel(I18n.translate("menu.file.stats.top_level_package")); | 65 | JLabel topLevelPackageOption = new JLabel(I18n.translate("menu.file.stats.top_level_package")); |
| 90 | contentPane.add(topLevelPackageOption, c); | 66 | contentPane.add(topLevelPackageOption, cb1.pos(0, results.size() + 1).build()); |
| 91 | 67 | ||
| 92 | c.gridy += 1; | ||
| 93 | c.weightx = 1.0; | ||
| 94 | c.fill = GridBagConstraints.HORIZONTAL; | ||
| 95 | JTextField topLevelPackage = new JTextField(); | 68 | JTextField topLevelPackage = new JTextField(); |
| 96 | contentPane.add(topLevelPackage, c); | 69 | contentPane.add(topLevelPackage, cb1.pos(0, results.size() + 2).fill(GridBagConstraints.HORIZONTAL).build()); |
| 97 | |||
| 98 | c.gridy += 1; | ||
| 99 | c.weighty = 1.0; | ||
| 100 | c.fill = GridBagConstraints.NONE; | ||
| 101 | c.anchor = GridBagConstraints.SOUTHEAST; | ||
| 102 | 70 | ||
| 103 | // show generate button | 71 | // show generate button |
| 104 | JButton button = new JButton(I18n.translate("menu.file.stats.generate")); | 72 | JButton button = new JButton(I18n.translate("menu.file.stats.generate")); |
| @@ -108,7 +76,7 @@ public class StatsDialog { | |||
| 108 | generateStats(gui, checkboxes, topLevelPackage.getText()); | 76 | generateStats(gui, checkboxes, topLevelPackage.getText()); |
| 109 | }); | 77 | }); |
| 110 | 78 | ||
| 111 | contentPane.add(button, c); | 79 | contentPane.add(button, cb1.pos(0, results.size() + 3).weightY(1.0).anchor(GridBagConstraints.SOUTHEAST).build()); |
| 112 | 80 | ||
| 113 | // add action listener to each checkbox | 81 | // add action listener to each checkbox |
| 114 | checkboxes.forEach((key, value) -> value.addActionListener(action -> { | 82 | checkboxes.forEach((key, value) -> value.addActionListener(action -> { |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java index 1ba0bbb1..e4a120b3 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java | |||
| @@ -31,6 +31,7 @@ import cuchaz.enigma.gui.events.EditorActionListener; | |||
| 31 | import cuchaz.enigma.gui.events.ThemeChangeListener; | 31 | import cuchaz.enigma.gui.events.ThemeChangeListener; |
| 32 | import cuchaz.enigma.gui.highlight.BoxHighlightPainter; | 32 | import cuchaz.enigma.gui.highlight.BoxHighlightPainter; |
| 33 | import cuchaz.enigma.gui.highlight.SelectionHighlightPainter; | 33 | import cuchaz.enigma.gui.highlight.SelectionHighlightPainter; |
| 34 | import cuchaz.enigma.gui.util.GridBagConstraintsBuilder; | ||
| 34 | import cuchaz.enigma.gui.util.ScaleUtil; | 35 | import cuchaz.enigma.gui.util.ScaleUtil; |
| 35 | import cuchaz.enigma.source.DecompiledClassSource; | 36 | import cuchaz.enigma.source.DecompiledClassSource; |
| 36 | import cuchaz.enigma.source.RenamableTokenType; | 37 | import cuchaz.enigma.source.RenamableTokenType; |
| @@ -364,15 +365,9 @@ public class EditorPanel { | |||
| 364 | this.decompilingProgressBar.setIndeterminate(true); | 365 | this.decompilingProgressBar.setIndeterminate(true); |
| 365 | 366 | ||
| 366 | this.ui.setLayout(new GridBagLayout()); | 367 | this.ui.setLayout(new GridBagLayout()); |
| 367 | GridBagConstraints c = new GridBagConstraints(); | 368 | GridBagConstraintsBuilder cb = GridBagConstraintsBuilder.create().insets(ScaleUtil.scale(2)); |
| 368 | c.gridx = 0; | 369 | this.ui.add(this.decompilingLabel, cb.pos(0, 0).anchor(GridBagConstraints.SOUTH).build()); |
| 369 | c.gridy = 0; | 370 | this.ui.add(this.decompilingProgressBar, cb.pos(0, 1).anchor(GridBagConstraints.NORTH).build()); |
| 370 | c.insets = ScaleUtil.getInsets(2, 2, 2, 2); | ||
| 371 | c.anchor = GridBagConstraints.SOUTH; | ||
| 372 | this.ui.add(this.decompilingLabel, c); | ||
| 373 | c.gridy = 1; | ||
| 374 | c.anchor = GridBagConstraints.NORTH; | ||
| 375 | this.ui.add(this.decompilingProgressBar, c); | ||
| 376 | break; | 371 | break; |
| 377 | } | 372 | } |
| 378 | case SUCCESS: { | 373 | case SUCCESS: { |
| @@ -382,26 +377,11 @@ public class EditorPanel { | |||
| 382 | } | 377 | } |
| 383 | case ERRORED: { | 378 | case ERRORED: { |
| 384 | this.ui.setLayout(new GridBagLayout()); | 379 | this.ui.setLayout(new GridBagLayout()); |
| 385 | GridBagConstraints c = new GridBagConstraints(); | 380 | GridBagConstraintsBuilder cb = GridBagConstraintsBuilder.create().insets(ScaleUtil.scale(2)).weight(1.0, 0.0).anchor(GridBagConstraints.WEST); |
| 386 | c.insets = ScaleUtil.getInsets(2, 2, 2, 2); | 381 | this.ui.add(this.errorLabel, cb.pos(0, 0).build()); |
| 387 | c.gridx = 0; | 382 | this.ui.add(new JSeparator(JSeparator.HORIZONTAL), cb.pos(0, 1).fill(GridBagConstraints.HORIZONTAL).build()); |
| 388 | c.gridy = 0; | 383 | this.ui.add(this.errorScrollPane, cb.pos(0, 2).weight(1.0, 1.0).fill(GridBagConstraints.BOTH).build()); |
| 389 | c.weightx = 1.0; | 384 | this.ui.add(this.retryButton, cb.pos(0, 3).weight(0.0, 0.0).anchor(GridBagConstraints.EAST).build()); |
| 390 | c.anchor = GridBagConstraints.WEST; | ||
| 391 | this.ui.add(this.errorLabel, c); | ||
| 392 | c.gridy = 1; | ||
| 393 | c.fill = GridBagConstraints.HORIZONTAL; | ||
| 394 | this.ui.add(new JSeparator(JSeparator.HORIZONTAL), c); | ||
| 395 | c.gridy = 2; | ||
| 396 | c.fill = GridBagConstraints.BOTH; | ||
| 397 | c.weighty = 1.0; | ||
| 398 | this.ui.add(this.errorScrollPane, c); | ||
| 399 | c.gridy = 3; | ||
| 400 | c.fill = GridBagConstraints.NONE; | ||
| 401 | c.anchor = GridBagConstraints.EAST; | ||
| 402 | c.weightx = 0.0; | ||
| 403 | c.weighty = 0.0; | ||
| 404 | this.ui.add(this.retryButton, c); | ||
| 405 | break; | 385 | break; |
| 406 | } | 386 | } |
| 407 | } | 387 | } |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/IdentifierPanel.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/IdentifierPanel.java index be316ee4..7704242f 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/IdentifierPanel.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/IdentifierPanel.java | |||
| @@ -4,7 +4,6 @@ import java.awt.Component; | |||
| 4 | import java.awt.Container; | 4 | import java.awt.Container; |
| 5 | import java.awt.GridBagConstraints; | 5 | import java.awt.GridBagConstraints; |
| 6 | import java.awt.GridBagLayout; | 6 | import java.awt.GridBagLayout; |
| 7 | import java.awt.Insets; | ||
| 8 | import java.awt.event.ItemEvent; | 7 | import java.awt.event.ItemEvent; |
| 9 | import java.util.function.Consumer; | 8 | import java.util.function.Consumer; |
| 10 | 9 | ||
| @@ -18,16 +17,13 @@ import cuchaz.enigma.analysis.EntryReference; | |||
| 18 | import cuchaz.enigma.gui.Gui; | 17 | import cuchaz.enigma.gui.Gui; |
| 19 | import cuchaz.enigma.gui.elements.ConvertingTextField; | 18 | import cuchaz.enigma.gui.elements.ConvertingTextField; |
| 20 | import cuchaz.enigma.gui.events.ConvertingTextFieldListener; | 19 | import cuchaz.enigma.gui.events.ConvertingTextFieldListener; |
| 20 | import cuchaz.enigma.gui.util.GridBagConstraintsBuilder; | ||
| 21 | import cuchaz.enigma.gui.util.GuiUtil; | 21 | import cuchaz.enigma.gui.util.GuiUtil; |
| 22 | import cuchaz.enigma.gui.util.ScaleUtil; | 22 | import cuchaz.enigma.gui.util.ScaleUtil; |
| 23 | import cuchaz.enigma.network.packet.RenameC2SPacket; | 23 | import cuchaz.enigma.network.packet.RenameC2SPacket; |
| 24 | import cuchaz.enigma.translation.mapping.AccessModifier; | 24 | import cuchaz.enigma.translation.mapping.AccessModifier; |
| 25 | import cuchaz.enigma.translation.mapping.EntryMapping; | 25 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| 26 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 26 | import cuchaz.enigma.translation.representation.entry.*; |
| 27 | import cuchaz.enigma.translation.representation.entry.Entry; | ||
| 28 | import cuchaz.enigma.translation.representation.entry.FieldEntry; | ||
| 29 | import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; | ||
| 30 | import cuchaz.enigma.translation.representation.entry.MethodEntry; | ||
| 31 | import cuchaz.enigma.utils.I18n; | 27 | import cuchaz.enigma.utils.I18n; |
| 32 | import cuchaz.enigma.utils.validation.ValidationContext; | 28 | import cuchaz.enigma.utils.validation.ValidationContext; |
| 33 | 29 | ||
| @@ -177,26 +173,12 @@ public class IdentifierPanel { | |||
| 177 | private final Container c; | 173 | private final Container c; |
| 178 | private final Entry<?> e; | 174 | private final Entry<?> e; |
| 179 | private final EnigmaProject project; | 175 | private final EnigmaProject project; |
| 180 | private final GridBagConstraints col1; | 176 | private int row; |
| 181 | private final GridBagConstraints col2; | ||
| 182 | 177 | ||
| 183 | public TableHelper(Container c, Entry<?> e, EnigmaProject project) { | 178 | public TableHelper(Container c, Entry<?> e, EnigmaProject project) { |
| 184 | this.c = c; | 179 | this.c = c; |
| 185 | this.e = e; | 180 | this.e = e; |
| 186 | this.project = project; | 181 | this.project = project; |
| 187 | this.col1 = new GridBagConstraints(); | ||
| 188 | this.col2 = new GridBagConstraints(); | ||
| 189 | Insets insets = ScaleUtil.getInsets(2, 2, 2, 2); | ||
| 190 | this.col1.gridx = 0; | ||
| 191 | this.col1.gridy = 0; | ||
| 192 | this.col1.insets = insets; | ||
| 193 | this.col1.anchor = GridBagConstraints.WEST; | ||
| 194 | this.col2.gridx = 1; | ||
| 195 | this.col2.gridy = 0; | ||
| 196 | this.col2.weightx = 1.0; | ||
| 197 | this.col2.fill = GridBagConstraints.HORIZONTAL; | ||
| 198 | this.col2.insets = insets; | ||
| 199 | this.col2.anchor = GridBagConstraints.WEST; | ||
| 200 | } | 182 | } |
| 201 | 183 | ||
| 202 | public void begin() { | 184 | public void begin() { |
| @@ -205,11 +187,13 @@ public class IdentifierPanel { | |||
| 205 | } | 187 | } |
| 206 | 188 | ||
| 207 | public void addRow(Component c1, Component c2) { | 189 | public void addRow(Component c1, Component c2) { |
| 208 | c.add(c1, col1); | 190 | GridBagConstraintsBuilder cb = GridBagConstraintsBuilder.create() |
| 209 | c.add(c2, col2); | 191 | .insets(ScaleUtil.scale(2)) |
| 192 | .anchor(GridBagConstraints.WEST); | ||
| 193 | c.add(c1, cb.pos(0, this.row).build()); | ||
| 194 | c.add(c2, cb.pos(1, this.row).weightX(1.0).fill(GridBagConstraints.HORIZONTAL).build()); | ||
| 210 | 195 | ||
| 211 | col1.gridy += 1; | 196 | this.row += 1; |
| 212 | col2.gridy += 1; | ||
| 213 | } | 197 | } |
| 214 | 198 | ||
| 215 | public ConvertingTextField addCovertTextField(String c1, String c2) { | 199 | public ConvertingTextField addCovertTextField(String c1, String c2) { |
| @@ -255,8 +239,7 @@ public class IdentifierPanel { | |||
| 255 | 239 | ||
| 256 | public void end() { | 240 | public void end() { |
| 257 | // Add an empty panel with y-weight=1 so that all the other elements get placed at the top edge | 241 | // Add an empty panel with y-weight=1 so that all the other elements get placed at the top edge |
| 258 | this.col1.weighty = 1.0; | 242 | c.add(new JPanel(), GridBagConstraintsBuilder.create().pos(0, row).weight(0.0, 1.0).build()); |
| 259 | c.add(new JPanel(), col1); | ||
| 260 | } | 243 | } |
| 261 | 244 | ||
| 262 | } | 245 | } |