remove the confusing shortform GridBagConstraints constant redefinitions

at least, they were confusing to me. i could never remember which ones
they corresponded to
This commit is contained in:
Gered 2016-01-16 12:58:42 -05:00
parent 91b91777de
commit 7870670ce0
12 changed files with 136 additions and 151 deletions

View file

@ -171,20 +171,20 @@ implements ActionListener, ListSelectionListener {
*/ */
private void placeComponents() { private void placeComponents() {
setLayout(new GridBagLayout()); setLayout(new GridBagLayout());
add(runTitleLabel, GBC.grid(0, 0).insets(4, 4, 0, 4).anchor(GBC.LE)); add(runTitleLabel, GBC.grid(0, 0).insets(4, 4, 0, 4).anchor(GBC.LINE_END));
add(runTitle, GBC.grid(1, 0, 3, 1).insets(4, 0, 0, 4).anchor(GBC.LS)); add(runTitle, GBC.grid(1, 0, 3, 1).insets(4, 0, 0, 4).anchor(GBC.LINE_START));
add(new JLabel("" + Language.LB_SUBTITLE), GBC.grid(0, 1).insets(4, 4, 0, 4).anchor(GBC.LE)); add(new JLabel("" + Language.LB_SUBTITLE), GBC.grid(0, 1).insets(4, 4, 0, 4).anchor(GBC.LINE_END));
add(runSubTitle, GBC.grid(1, 1).insets(4, 0, 0, 4).anchor(GBC.LS)); add(runSubTitle, GBC.grid(1, 1).insets(4, 0, 0, 4).anchor(GBC.LINE_START));
add(new JLabel("" + Language.ED_DELAYED_START), GBC.grid(0, 2).insets(4, 4, 0, 4).anchor(GBC.LE)); add(new JLabel("" + Language.ED_DELAYED_START), GBC.grid(0, 2).insets(4, 4, 0, 4).anchor(GBC.LINE_END));
add(runDelayedStart, GBC.grid(1, 2).insets(4, 0, 0, 4).anchor(GBC.LS)); add(runDelayedStart, GBC.grid(1, 2).insets(4, 0, 0, 4).anchor(GBC.LINE_START));
add(segmented, GBC.grid(2, 2, 2, 1).insets(4, 0, 0, 4).anchor(GBC.LS)); add(segmented, GBC.grid(2, 2, 2, 1).insets(4, 0, 0, 4).anchor(GBC.LINE_START));
add(segmentsLabel, GBC.grid(0, 3).insets(5, 4, 4, 0) add(segmentsLabel, GBC.grid(0, 3).insets(5, 4, 4, 0)
.anchor(GBC.LE)); .anchor(GBC.LINE_END));
add(scrollPane, GBC.grid(1, 3, 3, 4).insets(4, 4, 0, 0).anchor(GBC.LS)); add(scrollPane, GBC.grid(1, 3, 3, 4).insets(4, 4, 0, 0).anchor(GBC.LINE_START));
add(addSegment, GBC.grid(3, 3).insets(0, 4).anchor(GBC.FLS)); add(addSegment, GBC.grid(3, 3).insets(0, 4).anchor(GBC.FIRST_LINE_START));
add(remSegment, GBC.grid(3, 4).insets(4, 4).anchor(GBC.FLS)); add(remSegment, GBC.grid(3, 4).insets(4, 4).anchor(GBC.FIRST_LINE_START));
add(moveUp, GBC.grid(3, 5).insets(0, 4).anchor(GBC.FLS)); add(moveUp, GBC.grid(3, 5).insets(0, 4).anchor(GBC.FIRST_LINE_START));
add(moveDown, GBC.grid(3, 6).insets(4, 4).anchor(GBC.FLS)); add(moveDown, GBC.grid(3, 6).insets(4, 4).anchor(GBC.FIRST_LINE_START));
JPanel controls = new JPanel(); JPanel controls = new JPanel();
controls.add(save); controls.add(save);

View file

@ -299,46 +299,46 @@ public class TabComponents extends SettingsTab
fontPanel.add( fontPanel.add(
new JLabel("" + Language.setting_core_timerFont), new JLabel("" + Language.setting_core_timerFont),
GBC.grid(0, 0).anchor(GBC.LS).insets(0, 5) GBC.grid(0, 0).anchor(GBC.LINE_START).insets(0, 5)
); );
fontPanel.add(timerFont, GBC.grid(1, 0)); fontPanel.add(timerFont, GBC.grid(1, 0));
fontPanel.add(timerSize, GBC.grid(2, 0).insets(0, 5)); fontPanel.add(timerSize, GBC.grid(2, 0).insets(0, 5));
fontPanel.add( fontPanel.add(
new JLabel("" + Language.setting_core_segmentTimerFont), new JLabel("" + Language.setting_core_segmentTimerFont),
GBC.grid(0, 1).anchor(GBC.LS).insets(3, 5) GBC.grid(0, 1).anchor(GBC.LINE_START).insets(3, 5)
); );
fontPanel.add( fontPanel.add(
timerSameFont, timerSameFont,
GBC.grid(1, 1, 2, 1).anchor(GBC.LS).insets(3, 0) GBC.grid(1, 1, 2, 1).anchor(GBC.LINE_START).insets(3, 0)
); );
fontPanel.add(timerSegFont, GBC.grid(1, 2)); fontPanel.add(timerSegFont, GBC.grid(1, 2));
fontPanel.add(timerSegSize, GBC.grid(2, 2).insets(0, 5)); fontPanel.add(timerSegSize, GBC.grid(2, 2).insets(0, 5));
fontPanel.add( fontPanel.add(
new JLabel("" + Language.setting_header_titleFont), new JLabel("" + Language.setting_header_titleFont),
GBC.grid(0, 3).anchor(GBC.LS).insets(0, 5) GBC.grid(0, 3).anchor(GBC.LINE_START).insets(0, 5)
); );
fontPanel.add(headerTitleFont, GBC.grid(1, 3)); fontPanel.add(headerTitleFont, GBC.grid(1, 3));
fontPanel.add(headerTitleSize, GBC.grid(2, 3).insets(0, 5)); fontPanel.add(headerTitleSize, GBC.grid(2, 3).insets(0, 5));
fontPanel.add( fontPanel.add(
new JLabel("" + Language.setting_header_subTitleFont), new JLabel("" + Language.setting_header_subTitleFont),
GBC.grid(0, 4).anchor(GBC.LS).insets(0, 5) GBC.grid(0, 4).anchor(GBC.LINE_START).insets(0, 5)
); );
fontPanel.add(headerSubTitleFont, GBC.grid(1, 4)); fontPanel.add(headerSubTitleFont, GBC.grid(1, 4));
fontPanel.add(headerSubTitleSize, GBC.grid(2, 4).insets(0, 5)); fontPanel.add(headerSubTitleSize, GBC.grid(2, 4).insets(0, 5));
fontPanel.add( fontPanel.add(
new JLabel("" + Language.setting_core_font), new JLabel("" + Language.setting_core_font),
GBC.grid(0, 5).anchor(GBC.LS).insets(0, 5) GBC.grid(0, 5).anchor(GBC.LINE_START).insets(0, 5)
); );
fontPanel.add(coreFont, GBC.grid(1, 5)); fontPanel.add(coreFont, GBC.grid(1, 5));
fontPanel.add(coreFontSize, GBC.grid(2, 5).insets(0, 5)); fontPanel.add(coreFontSize, GBC.grid(2, 5).insets(0, 5));
fontPanel.add( fontPanel.add(
new JLabel("" + Language.setting_core_otherTimeFont), new JLabel("" + Language.setting_core_otherTimeFont),
GBC.grid(0, 6).anchor(GBC.LS).insets(0, 5) GBC.grid(0, 6).anchor(GBC.LINE_START).insets(0, 5)
); );
fontPanel.add(otherTimeFont, GBC.grid(1, 6)); fontPanel.add(otherTimeFont, GBC.grid(1, 6));
fontPanel.add(otherTimeSize, GBC.grid(2, 6).insets(0, 5)); fontPanel.add(otherTimeSize, GBC.grid(2, 6).insets(0, 5));
@ -346,43 +346,43 @@ public class TabComponents extends SettingsTab
JPanel timerPanel = new JPanel(new GridBagLayout()); { JPanel timerPanel = new JPanel(new GridBagLayout()); {
timerPanel.add( timerPanel.add(
new JLabel("" + Language.setting_core_iconSize), new JLabel("" + Language.setting_core_iconSize),
GBC.grid(0, 1).anchor(GBC.LE).insets(5, 5) GBC.grid(0, 1).anchor(GBC.LINE_END).insets(5, 5)
); );
timerPanel.add(iconSizes, GBC.grid(1, 1).insets(5, 5)); timerPanel.add(iconSizes, GBC.grid(1, 1).insets(5, 5));
timerPanel.add(checkBoxes.get(Settings.coreShowIcons.getKey()), GBC.grid(0, 2, 2, 1).anchor(GBC.LS)); timerPanel.add(checkBoxes.get(Settings.coreShowIcons.getKey()), GBC.grid(0, 2, 2, 1).anchor(GBC.LINE_START));
timerPanel.add(checkBoxes.get(Settings.coreShowSegmentName.getKey()), GBC.grid(0, 3, 2, 1).anchor(GBC.LS)); timerPanel.add(checkBoxes.get(Settings.coreShowSegmentName.getKey()), GBC.grid(0, 3, 2, 1).anchor(GBC.LINE_START));
timerPanel.add(checkBoxes.get(Settings.coreShowSplitTime.getKey()), GBC.grid(0, 4, 2, 1).anchor(GBC.LS)); timerPanel.add(checkBoxes.get(Settings.coreShowSplitTime.getKey()), GBC.grid(0, 4, 2, 1).anchor(GBC.LINE_START));
timerPanel.add(checkBoxes.get(Settings.coreShowSegmentTime.getKey()), GBC.grid(0, 5, 2, 1).anchor(GBC.LS)); timerPanel.add(checkBoxes.get(Settings.coreShowSegmentTime.getKey()), GBC.grid(0, 5, 2, 1).anchor(GBC.LINE_START));
timerPanel.add(checkBoxes.get(Settings.coreShowBestTime.getKey()), GBC.grid(0, 6, 2, 1).anchor(GBC.LS)); timerPanel.add(checkBoxes.get(Settings.coreShowBestTime.getKey()), GBC.grid(0, 6, 2, 1).anchor(GBC.LINE_START));
timerPanel.add(checkBoxes.get(Settings.coreShowSegmentTimer.getKey()), GBC.grid(0, 7, 2, 1).anchor(GBC.LS)); timerPanel.add(checkBoxes.get(Settings.coreShowSegmentTimer.getKey()), GBC.grid(0, 7, 2, 1).anchor(GBC.LINE_START));
timerPanel.setBorder( timerPanel.setBorder(
BorderFactory.createTitledBorder("" + Language.TIMER) BorderFactory.createTitledBorder("" + Language.TIMER)
); );
} }
JPanel footerPanel = new JPanel(new GridBagLayout()); { JPanel footerPanel = new JPanel(new GridBagLayout()); {
footerPanel.add(checkBoxes.get(Settings.footerDisplay.getKey()), GBC.grid(0, 0).anchor(GBC.LS)); footerPanel.add(checkBoxes.get(Settings.footerDisplay.getKey()), GBC.grid(0, 0).anchor(GBC.LINE_START));
footerPanel.add(checkBoxes.get(Settings.footerUseSplitData.getKey()), GBC.grid(0, 1).anchor(GBC.LS)); footerPanel.add(checkBoxes.get(Settings.footerUseSplitData.getKey()), GBC.grid(0, 1).anchor(GBC.LINE_START));
footerPanel.add(checkBoxes.get(Settings.footerVerbose.getKey()), GBC.grid(0, 2).anchor(GBC.LS)); footerPanel.add(checkBoxes.get(Settings.footerVerbose.getKey()), GBC.grid(0, 2).anchor(GBC.LINE_START));
footerPanel.add(checkBoxes.get(Settings.footerShowDeltaLabels.getKey()), GBC.grid(1, 0).anchor(GBC.LS)); footerPanel.add(checkBoxes.get(Settings.footerShowDeltaLabels.getKey()), GBC.grid(1, 0).anchor(GBC.LINE_START));
footerPanel.add(checkBoxes.get(Settings.footerShowBestTime.getKey()), GBC.grid(1, 1).anchor(GBC.LS)); footerPanel.add(checkBoxes.get(Settings.footerShowBestTime.getKey()), GBC.grid(1, 1).anchor(GBC.LINE_START));
footerPanel.add(checkBoxes.get(Settings.footerMultiline.getKey()), GBC.grid(1, 2).anchor(GBC.LS)); footerPanel.add(checkBoxes.get(Settings.footerMultiline.getKey()), GBC.grid(1, 2).anchor(GBC.LINE_START));
footerPanel.setBorder( footerPanel.setBorder(
BorderFactory.createTitledBorder("" + Language.FOOTER) BorderFactory.createTitledBorder("" + Language.FOOTER)
); );
} }
JPanel miscPanel = new JPanel(new GridBagLayout()); { JPanel miscPanel = new JPanel(new GridBagLayout()); {
miscPanel.add(checkBoxes.get(Settings.headerShowSubtitle.getKey()), GBC.grid(0, 0).anchor(GBC.LS)); miscPanel.add(checkBoxes.get(Settings.headerShowSubtitle.getKey()), GBC.grid(0, 0).anchor(GBC.LINE_START));
miscPanel.add(checkBoxes.get(Settings.headerShowTitle.getKey()), GBC.grid(0, 1).anchor(GBC.LS)); miscPanel.add(checkBoxes.get(Settings.headerShowTitle.getKey()), GBC.grid(0, 1).anchor(GBC.LINE_START));
miscPanel.add(checkBoxes.get(Settings.graphDisplay.getKey()), GBC.grid(0, 2).anchor(GBC.LS)); miscPanel.add(checkBoxes.get(Settings.graphDisplay.getKey()), GBC.grid(0, 2).anchor(GBC.LINE_START));
miscPanel.add(checkBoxes.get(Settings.headerShowAttempts.getKey()), GBC.grid(0, 3).anchor(GBC.LS)); miscPanel.add(checkBoxes.get(Settings.headerShowAttempts.getKey()), GBC.grid(0, 3).anchor(GBC.LINE_START));
miscPanel.setBorder( miscPanel.setBorder(
BorderFactory.createTitledBorder("" + Language.MISC) BorderFactory.createTitledBorder("" + Language.MISC)
); );
} }
add(fontPanel, GBC.grid(0, 0, 2, 1).fill(GBC.B).anchor(GBC.FLS)); add(fontPanel, GBC.grid(0, 0, 2, 1).fill(GBC.BOTH).anchor(GBC.FIRST_LINE_START));
add(timerPanel, GBC.grid(2, 0, 1, 2).fill(GBC.B).anchor(GBC.FLS)); add(timerPanel, GBC.grid(2, 0, 1, 2).fill(GBC.BOTH).anchor(GBC.FIRST_LINE_START));
add(footerPanel, GBC.grid(0, 1).fill(GBC.B).anchor(GBC.FLS)); add(footerPanel, GBC.grid(0, 1).fill(GBC.BOTH).anchor(GBC.FIRST_LINE_START));
add(miscPanel, GBC.grid(1, 1).fill(GBC.B).anchor(GBC.FLS)); add(miscPanel, GBC.grid(1, 1).fill(GBC.BOTH).anchor(GBC.FIRST_LINE_START));
} }
} }

View file

@ -164,13 +164,13 @@ public class TabGeneral extends SettingsTab implements ActionListener {
setLayout(new GridBagLayout()); setLayout(new GridBagLayout());
add( add(
alwaysOnTopText, GBC.grid(0, 0).anchor(GBC.LE).insets(5, 10) alwaysOnTopText, GBC.grid(0, 0).anchor(GBC.LINE_END).insets(5, 10)
); );
add(alwaysOnTop, GBC.grid(1, 0).anchor(GBC.LS)); add(alwaysOnTop, GBC.grid(1, 0).anchor(GBC.LINE_START));
add(warnOnReset, GBC.grid(1, 1).anchor(GBC.LS)); add(warnOnReset, GBC.grid(1, 1).anchor(GBC.LINE_START));
//add(languageText, GBC.grid(0, 2).anchor(GBC.LE).insets(10, 10)); //add(languageText, GBC.grid(0, 2).anchor(GBC.LINE_END).insets(10, 10));
//add(language, GBC.grid(1, 2).fill(GBC.H)); //add(language, GBC.grid(1, 2).fill(GBC.HORIZONTAL));
JPanel comparePanel = new JPanel(new GridLayout(0, 1)); { JPanel comparePanel = new JPanel(new GridLayout(0, 1)); {
Enumeration<AbstractButton> buttons = compare.getElements(); Enumeration<AbstractButton> buttons = compare.getElements();
@ -178,8 +178,8 @@ public class TabGeneral extends SettingsTab implements ActionListener {
comparePanel.add(buttons.nextElement()); comparePanel.add(buttons.nextElement());
} }
} }
add(compareText, GBC.grid(0, 3).anchor(GBC.FLE).insets(14, 10)); add(compareText, GBC.grid(0, 3).anchor(GBC.FIRST_LINE_END).insets(14, 10));
add(comparePanel, GBC.grid(1, 3).fill(GBC.H).insets(10, 0, 0, 0)); add(comparePanel, GBC.grid(1, 3).fill(GBC.HORIZONTAL).insets(10, 0, 0, 0));
JPanel accuracyPanel = new JPanel(new GridLayout(0, 1)); { JPanel accuracyPanel = new JPanel(new GridLayout(0, 1)); {
Enumeration<AbstractButton> buttons = accuracy.getElements(); Enumeration<AbstractButton> buttons = accuracy.getElements();
@ -187,15 +187,15 @@ public class TabGeneral extends SettingsTab implements ActionListener {
accuracyPanel.add(buttons.nextElement()); accuracyPanel.add(buttons.nextElement());
} }
} }
add(accuracyText, GBC.grid(0, 4).anchor(GBC.FLE).insets(14, 10)); add(accuracyText, GBC.grid(0, 4).anchor(GBC.FIRST_LINE_END).insets(14, 10));
add(accuracyPanel, GBC.grid(1, 4).fill(GBC.H).insets(10, 0)); add(accuracyPanel, GBC.grid(1, 4).fill(GBC.HORIZONTAL).insets(10, 0));
add(windowSizeLabel, GBC.grid(0, 5).anchor(GBC.LE).insets(5, 10)); add(windowSizeLabel, GBC.grid(0, 5).anchor(GBC.LINE_END).insets(5, 10));
add(windowUserResizable, GBC.grid(1, 5).anchor(GBC.LS)); add(windowUserResizable, GBC.grid(1, 5).anchor(GBC.LINE_START));
JPanel windowSizeContainer = new JPanel(); JPanel windowSizeContainer = new JPanel();
windowSizeContainer.add(windowSize); windowSizeContainer.add(windowSize);
windowSizeContainer.add(windowSizeUnitsText); windowSizeContainer.add(windowSizeUnitsText);
add(windowSizeContainer, GBC.grid(1, 6).anchor(GBC.LS)); add(windowSizeContainer, GBC.grid(1, 6).anchor(GBC.LINE_START));
} }
// --------------------------------------------------------- INTERNAL TYPES // --------------------------------------------------------- INTERNAL TYPES

View file

@ -264,11 +264,11 @@ class TabHistory extends SettingsTab implements ActionListener, ChangeListener {
showLast.setHorizontalTextPosition(JLabel.LEADING); showLast.setHorizontalTextPosition(JLabel.LEADING);
// Display // Display
JPanel display = new JPanel(new GridBagLayout()); { JPanel display = new JPanel(new GridBagLayout()); {
display.add(icons , GBC.grid(0, 0).anchor(GBC.LS)); display.add(icons , GBC.grid(0, 0).anchor(GBC.LINE_START));
display.add(lives , GBC.grid(0, 1).anchor(GBC.LS)); display.add(lives , GBC.grid(0, 1).anchor(GBC.LINE_START));
display.add(deltas, GBC.grid(0, 2).anchor(GBC.LS)); display.add(deltas, GBC.grid(0, 2).anchor(GBC.LINE_START));
// display.add(tabular, GBC.grid(0, 3).anchor(GBC.LS)); // display.add(tabular, GBC.grid(0, 3).anchor(GBC.LINE_START));
display.add(merge , GBC.grid(0, 4).anchor(GBC.LS)); display.add(merge , GBC.grid(0, 4).anchor(GBC.LINE_START));
display.setBorder( display.setBorder(
BorderFactory.createTitledBorder("" + Language.PN_DISPLAY) BorderFactory.createTitledBorder("" + Language.PN_DISPLAY)
); );
@ -277,19 +277,19 @@ class TabHistory extends SettingsTab implements ActionListener, ChangeListener {
JPanel dimension = new JPanel(new GridBagLayout()); { JPanel dimension = new JPanel(new GridBagLayout()); {
dimension.add( dimension.add(
new JLabel("" + Language.setting_history_iconSize), new JLabel("" + Language.setting_history_iconSize),
GBC.grid(0, 0).anchor(GBC.LE) GBC.grid(0, 0).anchor(GBC.LINE_END)
); );
dimension.add(iconSize, GBC.grid(1, 0).anchor(GBC.LE).insets(2, 3)); dimension.add(iconSize, GBC.grid(1, 0).anchor(GBC.LINE_END).insets(2, 3));
dimension.add( dimension.add(
new JLabel("" + Language.setting_history_rowCount), new JLabel("" + Language.setting_history_rowCount),
GBC.grid(0, 1).anchor(GBC.LE) GBC.grid(0, 1).anchor(GBC.LINE_END)
); );
dimension.add( dimension.add(
rows, GBC.grid(1, 1).anchor(GBC.LE).fill(GBC.H).insets(2, 3) rows, GBC.grid(1, 1).anchor(GBC.LINE_END).fill(GBC.HORIZONTAL).insets(2, 3)
); );
dimension.add(blankRows, GBC.grid(0, 2, 2, 1).anchor(GBC.LE)); dimension.add(blankRows, GBC.grid(0, 2, 2, 1).anchor(GBC.LINE_END));
dimension.add( dimension.add(
twoLines , GBC.grid(0, 3, 2, 1).anchor(GBC.LE).insets(0, 1) twoLines , GBC.grid(0, 3, 2, 1).anchor(GBC.LINE_END).insets(0, 1)
); );
dimension.setBorder( dimension.setBorder(
BorderFactory.createTitledBorder("" + Language.PN_DIMENSION) BorderFactory.createTitledBorder("" + Language.PN_DIMENSION)
@ -299,16 +299,16 @@ class TabHistory extends SettingsTab implements ActionListener, ChangeListener {
JPanel fonts = new JPanel(new GridBagLayout()); { JPanel fonts = new JPanel(new GridBagLayout()); {
fonts.add( fonts.add(
new JLabel("" + Language.setting_history_segmentFont), new JLabel("" + Language.setting_history_segmentFont),
GBC.grid(0, 0).anchor(GBC.LE) GBC.grid(0, 0).anchor(GBC.LINE_END)
); );
fonts.add(nameFont, GBC.grid(1, 0).anchor(GBC.LS).insets(5, 5)); fonts.add(nameFont, GBC.grid(1, 0).anchor(GBC.LINE_START).insets(5, 5));
fonts.add(nameSize, GBC.grid(2, 0).anchor(GBC.LS)); fonts.add(nameSize, GBC.grid(2, 0).anchor(GBC.LINE_START));
fonts.add( fonts.add(
new JLabel("" + Language.setting_history_timeFont), new JLabel("" + Language.setting_history_timeFont),
GBC.grid(0, 1).anchor(GBC.LE) GBC.grid(0, 1).anchor(GBC.LINE_END)
); );
fonts.add(timeFont, GBC.grid(1, 1).anchor(GBC.LS).insets(5, 5)); fonts.add(timeFont, GBC.grid(1, 1).anchor(GBC.LINE_START).insets(5, 5));
fonts.add(timeSize, GBC.grid(2, 1).anchor(GBC.LS)); fonts.add(timeSize, GBC.grid(2, 1).anchor(GBC.LINE_START));
fonts.setBorder( fonts.setBorder(
BorderFactory.createTitledBorder("" + Language.PN_FONTS) BorderFactory.createTitledBorder("" + Language.PN_FONTS)
); );
@ -316,22 +316,22 @@ class TabHistory extends SettingsTab implements ActionListener, ChangeListener {
// Scrolling // Scrolling
JPanel scrolling = new JPanel(new GridBagLayout()); { JPanel scrolling = new JPanel(new GridBagLayout()); {
scrolling.add( scrolling.add(
offsetHelper, GBC.grid(0, 0).anchor(GBC.LE).insets(0, 8) offsetHelper, GBC.grid(0, 0).anchor(GBC.LINE_END).insets(0, 8)
); );
scrolling.add( scrolling.add(
new JLabel("" + Language.setting_history_offset), new JLabel("" + Language.setting_history_offset),
GBC.grid(1, 0).anchor(GBC.LE) GBC.grid(1, 0).anchor(GBC.LINE_END)
); );
scrolling.add(offset , GBC.grid(2, 0).anchor(GBC.LE)); scrolling.add(offset , GBC.grid(2, 0).anchor(GBC.LINE_END));
scrolling.add(showLast, GBC.grid(0, 1, 3, 1).anchor(GBC.LE)); scrolling.add(showLast, GBC.grid(0, 1, 3, 1).anchor(GBC.LINE_END));
scrolling.setBorder( scrolling.setBorder(
BorderFactory.createTitledBorder("" + Language.PN_SCROLLING) BorderFactory.createTitledBorder("" + Language.PN_SCROLLING)
); );
} }
add(fonts , GBC.grid(0, 0).fill(GBC.B).padding(10, 10)); add(fonts , GBC.grid(0, 0).fill(GBC.BOTH).padding(10, 10));
add(dimension, GBC.grid(1, 0).fill(GBC.B).padding(10, 10)); add(dimension, GBC.grid(1, 0).fill(GBC.BOTH).padding(10, 10));
add(display , GBC.grid(0, 1).fill(GBC.B).padding(10, 10)); add(display , GBC.grid(0, 1).fill(GBC.BOTH).padding(10, 10));
add(scrolling, GBC.grid(1, 1).fill(GBC.B).padding(10, 10)); add(scrolling, GBC.grid(1, 1).fill(GBC.BOTH).padding(10, 10));
} }
} }

View file

@ -86,12 +86,12 @@ class TabHotkeys extends SettingsTab {
for (row = 0; row < keyFields.size(); row++) { for (row = 0; row < keyFields.size(); row++) {
add( add(
keyLabels.get(row), keyLabels.get(row),
GBC.grid(0, row).insets(10, 0, 10, 10).anchor(GBC.LE) GBC.grid(0, row).insets(10, 0, 10, 10).anchor(GBC.LINE_END)
); );
add(keyFields.get(row), GBC.grid(1, row)); add(keyFields.get(row), GBC.grid(1, row));
} }
add(globalHotKeys, GBC.grid(2, 3).insets(0, 50, 0, 0).anchor(GBC.LS)); add(globalHotKeys, GBC.grid(2, 3).insets(0, 50, 0, 0).anchor(GBC.LINE_START));
} }
// --------------------------------------------------------- INTERNAL TYPES // --------------------------------------------------------- INTERNAL TYPES

View file

@ -180,7 +180,7 @@ class TabLook extends SettingsTab implements ActionListener, ChangeListener {
for (int row = 0; row < colorButtons.size(); row++) { for (int row = 0; row < colorButtons.size(); row++) {
colorPanel.add( colorPanel.add(
colorTexts.get(row), colorTexts.get(row),
GBC.grid(0, row).anchor(GBC.LE).insets(1, 4) GBC.grid(0, row).anchor(GBC.LINE_END).insets(1, 4)
); );
colorPanel.add( colorPanel.add(
colorButtons.get(row), GBC.grid(1, row).insets(2, 0) colorButtons.get(row), GBC.grid(1, row).insets(2, 0)
@ -192,8 +192,8 @@ class TabLook extends SettingsTab implements ActionListener, ChangeListener {
swatchPanel.add(colorChooser, GBC.grid(0, 0)); swatchPanel.add(colorChooser, GBC.grid(0, 0));
swatchPanel.add(helperText, GBC.grid(0, 1)); swatchPanel.add(helperText, GBC.grid(0, 1));
} }
add(colorPanel, GBC.grid(0, 0).fill(GBC.B)); add(colorPanel, GBC.grid(0, 0).fill(GBC.BOTH));
add(swatchPanel, GBC.grid(1, 0).fill(GBC.B)); add(swatchPanel, GBC.grid(1, 0).fill(GBC.BOTH));
} }
// --------------------------------------------------------- INTERNAL TYPES // --------------------------------------------------------- INTERNAL TYPES

View file

@ -449,35 +449,35 @@ class Core extends JPanel implements ActionListener {
setLayout(new GridBagLayout()); setLayout(new GridBagLayout());
JPanel infoPanel = new JPanel(new GridBagLayout()); { JPanel infoPanel = new JPanel(new GridBagLayout()); {
infoPanel.add( infoPanel.add(
name, GBC.grid(0, 0, 2, 1).anchor(GBC.LS).weight(1.0, 0.0) name, GBC.grid(0, 0, 2, 1).anchor(GBC.LINE_START).weight(1.0, 0.0)
); );
infoPanel.add( infoPanel.add(
labelSplit, GBC.grid(0, 1).anchor(GBC.LS).insets(0, 0, 0, 3) labelSplit, GBC.grid(0, 1).anchor(GBC.LINE_START).insets(0, 0, 0, 3)
); );
infoPanel.add( infoPanel.add(
split, GBC.grid(1, 1).anchor(GBC.LS).weight(1.0, 0.0) split, GBC.grid(1, 1).anchor(GBC.LINE_START).weight(1.0, 0.0)
); );
infoPanel.add( infoPanel.add(
labelSegment, labelSegment,
GBC.grid(0, 2).anchor(GBC.LS).insets(0, 0, 0, 3) GBC.grid(0, 2).anchor(GBC.LINE_START).insets(0, 0, 0, 3)
); );
infoPanel.add( infoPanel.add(
segment, GBC.grid(1, 2).anchor(GBC.LS).weight(1.0, 0.0) segment, GBC.grid(1, 2).anchor(GBC.LINE_START).weight(1.0, 0.0)
); );
infoPanel.add( infoPanel.add(
labelBest, GBC.grid(0, 3).anchor(GBC.LS).insets(0, 0, 0, 3) labelBest, GBC.grid(0, 3).anchor(GBC.LINE_START).insets(0, 0, 0, 3)
); );
infoPanel.add(best, GBC.grid(1, 3).anchor(GBC.LS).weight(1.0, 0.0)); infoPanel.add(best, GBC.grid(1, 3).anchor(GBC.LINE_START).weight(1.0, 0.0));
infoPanel.setOpaque(false); infoPanel.setOpaque(false);
} }
JPanel timePanel = new JPanel(new GridBagLayout()); { JPanel timePanel = new JPanel(new GridBagLayout()); {
timePanel.add(splitTimer, GBC.grid(0, 0).anchor(GBC.LE)); timePanel.add(splitTimer, GBC.grid(0, 0).anchor(GBC.LINE_END));
timePanel.add(segmentTimer, GBC.grid(0, 1).anchor(GBC.LE)); timePanel.add(segmentTimer, GBC.grid(0, 1).anchor(GBC.LINE_END));
timePanel.setOpaque(false); timePanel.setOpaque(false);
} }
add(icon, GBC.grid(0, 0).insets(0, 0, 0, 8)); add(icon, GBC.grid(0, 0).insets(0, 0, 0, 8));
add(infoPanel, GBC.grid(1, 0).fill(GBC.B).weight(1.0, 1.0)); add(infoPanel, GBC.grid(1, 0).fill(GBC.BOTH).weight(1.0, 1.0));
add(timePanel, GBC.grid(2, 0).fill(GBC.H)); add(timePanel, GBC.grid(2, 0).fill(GBC.HORIZONTAL));
} }
private void updateVisibility(int identifier) { private void updateVisibility(int identifier) {

View file

@ -256,55 +256,55 @@ class Footer extends JPanel {
JPanel timePanel = new JPanel(new GridBagLayout()); { JPanel timePanel = new JPanel(new GridBagLayout()); {
timePanel.add( timePanel.add(
labelPrev, labelPrev,
GBC.grid(0, 0).anchor(GBC.LS).insets(0, 0, 0, INSET) GBC.grid(0, 0).anchor(GBC.LINE_START).insets(0, 0, 0, INSET)
); );
timePanel.add(liveL, GBC.grid(1, 0).anchor(GBC.LS)); timePanel.add(liveL, GBC.grid(1, 0).anchor(GBC.LINE_START));
timePanel.add(time, GBC.grid(2, 0).anchor(GBC.LS)); timePanel.add(time, GBC.grid(2, 0).anchor(GBC.LINE_START));
timePanel.add( timePanel.add(
inlineBest, inlineBest,
GBC.grid(3, 0).anchor(GBC.LS).insets(0, INSET, 0, 0) GBC.grid(3, 0).anchor(GBC.LINE_START).insets(0, INSET, 0, 0)
); );
timePanel.setOpaque(false); timePanel.setOpaque(false);
} }
JPanel deltaPanel = new JPanel(new GridBagLayout()); { JPanel deltaPanel = new JPanel(new GridBagLayout()); {
deltaPanel.add( deltaPanel.add(
labelDelta, labelDelta,
GBC.grid(0, 0).anchor(GBC.LE).insets(0, 0, 0, INSET) GBC.grid(0, 0).anchor(GBC.LINE_END).insets(0, 0, 0, INSET)
); );
deltaPanel.add( deltaPanel.add(
labelLive, labelLive,
GBC.grid(1, 0).anchor(GBC.LE).insets(0, 0, 0, INSET) GBC.grid(1, 0).anchor(GBC.LINE_END).insets(0, 0, 0, INSET)
); );
deltaPanel.add( deltaPanel.add(
liveR, GBC.grid(2, 0).anchor(GBC.LE).insets(0, 0, 0, INSET) liveR, GBC.grid(2, 0).anchor(GBC.LINE_END).insets(0, 0, 0, INSET)
); );
deltaPanel.add(delta, GBC.grid(3, 0).anchor(GBC.LE)); deltaPanel.add(delta, GBC.grid(3, 0).anchor(GBC.LINE_END));
deltaPanel.add( deltaPanel.add(
inlineDeltaBest, inlineDeltaBest,
GBC.grid(4, 0).anchor(GBC.LE).insets(0, INSET, 0, 0) GBC.grid(4, 0).anchor(GBC.LINE_END).insets(0, INSET, 0, 0)
); );
deltaPanel.setOpaque(false); deltaPanel.setOpaque(false);
} }
panelBest = new JPanel(new GridBagLayout()); { panelBest = new JPanel(new GridBagLayout()); {
panelBest.add( panelBest.add(
labelBest, labelBest,
GBC.grid(0, 0).anchor(GBC.LS).insets(0, 0, 0, INSET) GBC.grid(0, 0).anchor(GBC.LINE_START).insets(0, 0, 0, INSET)
); );
panelBest.add(best, GBC.grid(1, 0).anchor(GBC.LS)); panelBest.add(best, GBC.grid(1, 0).anchor(GBC.LINE_START));
panelBest.setOpaque(false); panelBest.setOpaque(false);
} }
panelDeltaBest = new JPanel(new GridBagLayout()); { panelDeltaBest = new JPanel(new GridBagLayout()); {
panelDeltaBest.add( panelDeltaBest.add(
labelDeltaBest, labelDeltaBest,
GBC.grid(0, 0).anchor(GBC.LE).insets(0, 0, 0, INSET) GBC.grid(0, 0).anchor(GBC.LINE_END).insets(0, 0, 0, INSET)
); );
panelDeltaBest.add(deltaBest, GBC.grid(1, 0).anchor(GBC.LE)); panelDeltaBest.add(deltaBest, GBC.grid(1, 0).anchor(GBC.LINE_END));
panelDeltaBest.setOpaque(false); panelDeltaBest.setOpaque(false);
} }
add(timePanel, GBC.grid(0, 0).anchor(GBC.LS).weight(0.5, 0.0)); add(timePanel, GBC.grid(0, 0).anchor(GBC.LINE_START).weight(0.5, 0.0));
add(deltaPanel, GBC.grid(1, 0).anchor(GBC.LE).weight(0.5, 0.0)); add(deltaPanel, GBC.grid(1, 0).anchor(GBC.LINE_END).weight(0.5, 0.0));
add(panelBest, GBC.grid(0, 1).anchor(GBC.LS).weight(0.5, 0.0)); add(panelBest, GBC.grid(0, 1).anchor(GBC.LINE_START).weight(0.5, 0.0));
add(panelDeltaBest, GBC.grid(1, 1).anchor(GBC.LE).weight(0.5, 0.0)); add(panelDeltaBest, GBC.grid(1, 1).anchor(GBC.LINE_END).weight(0.5, 0.0));
} }
private void updateVisibility(int identifier) { private void updateVisibility(int identifier) {

View file

@ -239,8 +239,8 @@ class Graph extends JPanel {
scalePanel.add(scale); scalePanel.add(scale);
scalePanel.setOpaque(false); scalePanel.setOpaque(false);
} }
add(scalePanel, GBC.grid(0, 0).anchor(GBC.LS)); add(scalePanel, GBC.grid(0, 0).anchor(GBC.LINE_START));
add(canvas, GBC.grid(0, 1).fill(GBC.B).weight(1.0, 1.0)); add(canvas, GBC.grid(0, 1).fill(GBC.BOTH).weight(1.0, 1.0));
} }
/** /**

View file

@ -333,7 +333,7 @@ public class History extends JPanel {
// Create and place the rows. // Create and place the rows.
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
SegmentRow row = new SegmentRow(); SegmentRow row = new SegmentRow();
add(row, GBC.grid(0, i).fill(GBC.H).weight(1.0, 0.0)); add(row, GBC.grid(0, i).fill(GBC.HORIZONTAL).weight(1.0, 0.0));
segmentRows.add(i, row); segmentRows.add(i, row);
} }
// Fill the rows with the segment data and colorize. // Fill the rows with the segment data and colorize.
@ -686,23 +686,23 @@ public class History extends JPanel {
private void placeComponents(boolean multiline) { private void placeComponents(boolean multiline) {
if (!multiline) { if (!multiline) {
add(icon , GBC.grid(0, 0).anchor(GBC.C)); add(icon , GBC.grid(0, 0).anchor(GBC.CENTER));
add( add(
name, GBC.grid(1, 0).insets(0, INSET, 0, 0).anchor(GBC.LS) name, GBC.grid(1, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_START)
.fill(GBC.H).weight(1.0, 0.0) .fill(GBC.HORIZONTAL).weight(1.0, 0.0)
); );
add(time , GBC.grid(2, 0).insets(0, INSET, 0, 0).anchor(GBC.LE)); add(time , GBC.grid(2, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
add(live , GBC.grid(3, 0).insets(0, INSET, 0, 0).anchor(GBC.LE)); add(live , GBC.grid(3, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
add(delta, GBC.grid(4, 0).insets(0, INSET, 0, 0).anchor(GBC.LE)); add(delta, GBC.grid(4, 0).insets(0, INSET, 0, 0).anchor(GBC.LINE_END));
} else { } else {
add(icon, GBC.grid(0, 0, 1, 2).anchor(GBC.C)); add(icon, GBC.grid(0, 0, 1, 2).anchor(GBC.CENTER));
add( add(
name, GBC.grid(1, 0, 3, 1).anchor(GBC.LS).fill(GBC.H) name, GBC.grid(1, 0, 3, 1).anchor(GBC.LINE_START).fill(GBC.HORIZONTAL)
.weight(1.0, 0.0).insets(0, INSET, 0, 0) .weight(1.0, 0.0).insets(0, INSET, 0, 0)
); );
add(time, GBC.grid(1, 1).anchor(GBC.LE).insets(0, INSET, 0, 0)); add(time, GBC.grid(1, 1).anchor(GBC.LINE_END).insets(0, INSET, 0, 0));
add(live, GBC.grid(2, 1).anchor(GBC.LE).insets(0, INSET, 0, 0)); add(live, GBC.grid(2, 1).anchor(GBC.LINE_END).insets(0, INSET, 0, 0));
add(delta, GBC.grid(3, 1).anchor(GBC.LE)); add(delta, GBC.grid(3, 1).anchor(GBC.LINE_END));
} }
} }
} }

View file

@ -288,13 +288,13 @@ public class RunPane extends JPanel {
* Places the sub-components within this component. * Places the sub-components within this component.
*/ */
private void placeComponents() { private void placeComponents() {
add(title, GBC.grid(0, 0).insets(3, 0, 1, 0).fill(GBC.B)); add(title, GBC.grid(0, 0).insets(3, 0, 1, 0).fill(GBC.BOTH));
add(subTitle, GBC.grid(0, 1).insets(3, 0, 0, 0).fill(GBC.B)); add(subTitle, GBC.grid(0, 1).insets(3, 0, 0, 0).fill(GBC.BOTH));
add(attemptCounter, GBC.grid(0, 2).insets(1, 0, 1, 3).anchor(GBC.LE)); add(attemptCounter, GBC.grid(0, 2).insets(1, 0, 1, 3).anchor(GBC.LINE_END));
add(createSeparator(), GBC.grid(0, 3).insets(3, 0).fill(GBC.H)); add(createSeparator(), GBC.grid(0, 3).insets(3, 0).fill(GBC.HORIZONTAL));
add(history, GBC.grid(0, 4).fill(GBC.H).insets(0, 5)); add(history, GBC.grid(0, 4).fill(GBC.HORIZONTAL).insets(0, 5));
add(createSeparator(), GBC.grid(0, 5).insets(3, 0).fill(GBC.H)); add(createSeparator(), GBC.grid(0, 5).insets(3, 0).fill(GBC.HORIZONTAL));
add(createSeparator(), GBC.grid(0, 7).insets(3, 0, 0, 0).fill(GBC.H)); add(createSeparator(), GBC.grid(0, 7).insets(3, 0, 0, 0).fill(GBC.HORIZONTAL));
updateVisibility(ALL); updateVisibility(ALL);
} }
@ -382,19 +382,19 @@ public class RunPane extends JPanel {
if ((identifier & GRAPH) == GRAPH) { if ((identifier & GRAPH) == GRAPH) {
if (Settings.graphDisplay.get()) { if (Settings.graphDisplay.get()) {
remove(core); remove(core);
add(core, GBC.grid(0, 6).insets(0, 5).fill(GBC.H)); add(core, GBC.grid(0, 6).insets(0, 5).fill(GBC.HORIZONTAL));
add(graph, GBC.grid(0, 8).fill(GBC.B).insets(0, 0, 3, 0) add(graph, GBC.grid(0, 8).fill(GBC.BOTH).insets(0, 0, 3, 0)
.weight(1.0, 1.0)); .weight(1.0, 1.0));
} else { } else {
remove(graph); remove(graph);
remove(core); remove(core);
add(core, GBC.grid(0, 6).insets(0, 5).fill(GBC.H) add(core, GBC.grid(0, 6).insets(0, 5).fill(GBC.HORIZONTAL)
.weight(1.0, 1.0)); .weight(1.0, 1.0));
} }
} }
if ((identifier & FOOTER) == FOOTER) { if ((identifier & FOOTER) == FOOTER) {
if (Settings.footerDisplay.get()) { if (Settings.footerDisplay.get()) {
add(footer, GBC.grid(0, 9).insets(0, 3).fill(GBC.H)); add(footer, GBC.grid(0, 9).insets(0, 3).fill(GBC.HORIZONTAL));
} else { } else {
remove(footer); remove(footer);
} }

View file

@ -9,21 +9,6 @@ import java.awt.GridBagConstraints;
import java.awt.Insets; import java.awt.Insets;
public class GBC extends GridBagConstraints { public class GBC extends GridBagConstraints {
public static final int LS = 21;
public static final int LE = 22;
public static final int PS = 19;
public static final int PE = 20;
public static final int BL = 512;
public static final int BT = 768;
public static final int FLS = 23;
public static final int FLE = 24;
public static final int LLS = 25;
public static final int LLE = 26;
public static final int H = 2;
public static final int V = 3;
public static final int C = 10;
public static final int B = 1;
public GBC() { public GBC() {
} }