use of javax.swing.border.TitledBorder in project ChatGameFontificator by GlitchCog.
the class ControlPanelChat method build.
@Override
protected void build() {
resizableBox = new JCheckBox("Resize Chat by Dragging");
scrollableBox = new JCheckBox("Mouse Wheel Scrolls Chat");
reverseScrollBox = new JCheckBox("Reverse Chat Order");
chatFromBottomBox = new JCheckBox("Chat Starts from Bottom");
widthInput = new LabeledInput("Width", 3);
heightInput = new LabeledInput("Height", 3);
DocumentListener chatSizeDocListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
somethingChanged(e);
}
@Override
public void removeUpdate(DocumentEvent e) {
somethingChanged(e);
}
@Override
public void changedUpdate(DocumentEvent e) {
somethingChanged(e);
}
/**
* Something changed, so try to get the new width and height and set the updateSizeButton to enabled or
* disabled accordingly
*
* @param e
*/
private void somethingChanged(DocumentEvent e) {
try {
int w = Integer.parseInt(widthInput.getText());
int h = Integer.parseInt(heightInput.getText());
updateSizeButton.setEnabled(w != config.getWidth() || h != config.getHeight());
} catch (Exception ex) {
updateSizeButton.setEnabled(false);
}
}
};
DocumentListener chromaDocListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
toggleChromaButtonEnabled();
}
@Override
public void removeUpdate(DocumentEvent e) {
toggleChromaButtonEnabled();
}
@Override
public void changedUpdate(DocumentEvent e) {
toggleChromaButtonEnabled();
}
};
widthInput.addDocumentListener(chatSizeDocListener);
heightInput.addDocumentListener(chatSizeDocListener);
updateSizeButton = new JButton("Update Chat Size");
chromaEnabledBox = new JCheckBox("Enable Chroma Key Border");
chromaInvertBox = new JCheckBox("Invert Chroma Key Border");
chromaCornerSlider = new LabeledSlider("Corner Radius", "pixels", ConfigChat.MIN_CHROMA_CORNER_RADIUS, ConfigChat.MAX_CHROMA_CORNER_RADIUS);
final String[] chromaLabels = new String[] { "Left", "Top", "Right", "Bottom" };
chromaBorderInput = new LabeledInput[chromaLabels.length];
for (int i = 0; i < chromaBorderInput.length; i++) {
chromaBorderInput[i] = new LabeledInput(chromaLabels[i], 4);
chromaBorderInput[i].addDocumentListener(chromaDocListener);
}
updateChromaSizeButton = new JButton("Update Chroma Border");
ActionListener boxListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JCheckBox source = (JCheckBox) e.getSource();
if (resizableBox.equals(source)) {
chatWindow.setResizable(resizableBox.isSelected());
config.setResizable(resizableBox.isSelected());
} else if (scrollableBox.equals(source)) {
config.setScrollable(scrollableBox.isSelected());
if (!scrollableBox.isSelected()) {
// No scrolling, so reset any existing scroll offset
chat.resetScrollOffset();
}
} else if (reverseScrollBox.equals(source)) {
config.setReverseScrolling(reverseScrollBox.isSelected());
} else if (chatFromBottomBox.equals(source)) {
// Reset scrolling to avoid having to translate it between chat-start top/bottom styles
chat.resetScrollOffset();
config.setChatFromBottom(chatFromBottomBox.isSelected());
} else if (chromaEnabledBox.equals(source)) {
config.setChromaEnabled(chromaEnabledBox.isSelected());
toggleChromaInputFields();
} else if (chromaInvertBox.equals(source)) {
config.setChromaInvert(chromaInvertBox.isSelected());
}
chat.repaint();
}
};
resizableBox.addActionListener(boxListener);
scrollableBox.addActionListener(boxListener);
reverseScrollBox.addActionListener(boxListener);
chatFromBottomBox.addActionListener(boxListener);
chromaEnabledBox.addActionListener(boxListener);
chromaInvertBox.addActionListener(boxListener);
ActionListener dimListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
LoadConfigReport report = new LoadConfigReport();
config.validateDimStrings(report, widthInput.getText(), heightInput.getText());
if (report.isErrorFree()) {
final int width = Integer.parseInt(widthInput.getText());
final int height = Integer.parseInt(heightInput.getText());
config.setWidth(width);
config.setHeight(height);
chatWindow.setSize(config.getWidth(), config.getHeight());
} else {
ChatWindow.popup.handleProblem(report);
}
} catch (Exception ex) {
ChatWindow.popup.handleProblem("Chat Width and Chat Height values could not be parsed", ex);
}
}
};
updateSizeButton.addActionListener(dimListener);
ActionListener chromaDimListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
LoadConfigReport report = new LoadConfigReport();
config.validateChromaDimStrings(report, chromaBorderInput[0].getText(), chromaBorderInput[1].getText(), chromaBorderInput[2].getText(), chromaBorderInput[3].getText());
if (report.isErrorFree()) {
inputToConfigChromaBorders();
chat.repaint();
} else {
ChatWindow.popup.handleProblem(report);
}
} catch (Exception ex) {
ChatWindow.popup.handleProblem("Chat Chroma border values could not be parsed", ex);
}
}
};
updateChromaSizeButton.addActionListener(chromaDimListener);
chromaCornerSlider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
config.setChromaCornerRadius(chromaCornerSlider.getValue());
chat.repaint();
}
});
JPanel chatDimPanel = new JPanel(new GridBagLayout());
JPanel chatOptionsPanel = new JPanel(new GridBagLayout());
JPanel chromaDimPanel = new JPanel(new GridBagLayout());
chatDimPanel.setBorder(new TitledBorder(baseBorder, "Chat Window Size", TitledBorder.CENTER, TitledBorder.TOP));
chatOptionsPanel.setBorder(new TitledBorder(baseBorder, "Chat Window Options", TitledBorder.CENTER, TitledBorder.TOP));
chromaDimPanel.setBorder(baseBorder);
GridBagConstraints dGbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, DEFAULT_INSETS, 0, 0);
dGbc.gridx = 0;
dGbc.gridy = 0;
dGbc.gridwidth = 1;
chatDimPanel.add(widthInput, dGbc);
dGbc.gridx++;
chatDimPanel.add(heightInput, dGbc);
dGbc.gridx = 0;
dGbc.gridy++;
dGbc.gridwidth = 2;
chatDimPanel.add(updateSizeButton, dGbc);
dGbc.gridy++;
chatDimPanel.add(resizableBox, dGbc);
dGbc.gridy++;
GridBagConstraints coGbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, DEFAULT_INSETS, 0, 0);
coGbc.anchor = GridBagConstraints.WEST;
chatOptionsPanel.add(scrollableBox, coGbc);
coGbc.gridy++;
chatOptionsPanel.add(reverseScrollBox, coGbc);
coGbc.gridy++;
chatOptionsPanel.add(chatFromBottomBox, coGbc);
coGbc.gridy++;
GridBagConstraints chromaGbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, NO_INSETS, 0, 0);
chromaGbc.gridwidth = 3;
chromaDimPanel.add(chromaEnabledBox, chromaGbc);
chromaGbc.gridy++;
chromaDimPanel.add(chromaBorderInput[1], chromaGbc);
chromaGbc.gridy++;
chromaGbc.gridwidth = 1;
chromaGbc.anchor = GridBagConstraints.EAST;
chromaDimPanel.add(chromaBorderInput[0], chromaGbc);
chromaGbc.gridx++;
chromaGbc.anchor = GridBagConstraints.CENTER;
chromaDimPanel.add(updateChromaSizeButton, chromaGbc);
chromaGbc.gridx++;
chromaGbc.anchor = GridBagConstraints.WEST;
chromaDimPanel.add(chromaBorderInput[2], chromaGbc);
chromaGbc.gridx = 0;
chromaGbc.anchor = GridBagConstraints.CENTER;
chromaGbc.gridy++;
chromaGbc.gridwidth = 3;
chromaDimPanel.add(chromaBorderInput[3], chromaGbc);
chromaGbc.gridy++;
chromaDimPanel.add(chromaInvertBox, chromaGbc);
chromaGbc.gridy++;
chromaDimPanel.add(chromaCornerSlider, chromaGbc);
JPanel everything = new JPanel(new GridBagLayout());
GridBagConstraints eGbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, NO_INSETS, 0, 0);
eGbc.weighty = 0.5;
eGbc.weightx = 0.5;
eGbc.fill = GridBagConstraints.HORIZONTAL;
eGbc.insets = new Insets(0, 3, 0, 3);
everything.add(chatDimPanel, eGbc);
eGbc.weightx = 0.5;
eGbc.gridx++;
everything.add(chatOptionsPanel, eGbc);
eGbc.weightx = 1.0;
eGbc.weighty = 0.0;
eGbc.gridx = 0;
eGbc.gridy++;
eGbc.gridwidth = 2;
eGbc.fill = GridBagConstraints.BOTH;
eGbc.anchor = GridBagConstraints.CENTER;
everything.add(chromaDimPanel, eGbc);
eGbc.gridy++;
gbc.anchor = GridBagConstraints.NORTH;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
add(everything, gbc);
}
use of javax.swing.border.TitledBorder in project ChatGameFontificator by GlitchCog.
the class ControlPanelColor method build.
@Override
protected void build() {
useTwitchBox = new JCheckBox("Override Palette with Twitch Username Colors when Available");
joinBox = new JCheckBox("Color Join Messages");
usernameBox = new JCheckBox("Color Usernames");
timestampBox = new JCheckBox("Color Timestamps");
messageBox = new JCheckBox("Color Messages");
ActionListener boxListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JCheckBox source = (JCheckBox) e.getSource();
if (useTwitchBox.equals(source)) {
config.setUseTwitchColors(source.isSelected());
} else if (joinBox.equals(source)) {
config.setColorJoin(source.isSelected());
} else if (usernameBox.equals(source)) {
config.setColorUsername(source.isSelected());
} else if (timestampBox.equals(source)) {
config.setColorTimestamp(source.isSelected());
} else if (messageBox.equals(source)) {
config.setColorMessage(source.isSelected());
}
chat.repaint();
}
};
useTwitchBox.addActionListener(boxListener);
joinBox.addActionListener(boxListener);
usernameBox.addActionListener(boxListener);
timestampBox.addActionListener(boxListener);
messageBox.addActionListener(boxListener);
bgColorButton = new ColorButton("Background", Color.BLACK, "Set the color of the background of the chat", this);
chromaColorButton = new ColorButton("Chroma Key", Color.GREEN, "Set the color for the chroma key border region", this);
fgColorButton = new ColorButton("Text Tint", Color.WHITE, "Set the color of the text of the chat", this);
borderColorButton = new ColorButton("Border Tint", Color.WHITE, "Set the color of the border of the chat", this);
highlightButton = new ColorButton("Highlight Tint", Color.YELLOW, "Set the default color used to highlight the text of the chat", this);
palette = new Palette(Color.BLACK, this);
JPanel topColorPanel = new JPanel(new GridLayout(2, 1));
JPanel botOptionsPanel = new JPanel(new GridBagLayout());
JPanel palettePanel = new JPanel(new GridBagLayout());
topColorPanel.setBorder(new TitledBorder(baseBorder, "Color Selections", TitledBorder.CENTER, TitledBorder.TOP));
palettePanel.setBorder(new TitledBorder(baseBorder, "Palette of Colors drawn from, per Username", TitledBorder.CENTER, TitledBorder.TOP));
botOptionsPanel.setBorder(new TitledBorder(baseBorder, "Color Options", TitledBorder.CENTER, TitledBorder.TOP));
JPanel colorPanelA = new JPanel(new GridLayout(1, 2));
colorPanelA.add(bgColorButton);
colorPanelA.add(chromaColorButton);
JPanel colorPanelB = new JPanel(new GridLayout(1, 3));
colorPanelB.add(fgColorButton);
colorPanelB.add(highlightButton);
colorPanelB.add(borderColorButton);
topColorPanel.add(colorPanelA);
topColorPanel.add(colorPanelB);
GridBagConstraints ppGbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, NO_INSETS, 0, 0);
palettePanel.add(palette, ppGbc);
ppGbc.gridy++;
palettePanel.add(useTwitchBox, ppGbc);
GridBagConstraints optionsGbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, DEFAULT_INSETS, 0, 0);
botOptionsPanel.add(joinBox, optionsGbc);
optionsGbc.gridx++;
botOptionsPanel.add(usernameBox, optionsGbc);
optionsGbc.gridx = 0;
optionsGbc.gridy++;
botOptionsPanel.add(timestampBox, optionsGbc);
optionsGbc.gridx++;
botOptionsPanel.add(messageBox, optionsGbc);
gbc.anchor = GridBagConstraints.NORTH;
gbc.weighty = 0.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
add(topColorPanel, gbc);
gbc.gridy++;
add(palettePanel, gbc);
gbc.gridy++;
add(botOptionsPanel, gbc);
// Filler panel
gbc.gridy++;
gbc.anchor = GridBagConstraints.SOUTH;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
add(new JPanel(), gbc);
gbc.gridy++;
}
use of javax.swing.border.TitledBorder in project ChatGameFontificator by GlitchCog.
the class ControlPanelFont method build.
@Override
protected void build() {
sliderListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider) e.getSource();
if (fontScaleSlider.getSlider().equals(source)) {
config.setFontScale(fontScaleSlider.getScaledValue());
fontScaleSlider.setValueTextColor(((int) config.getFontScale() == config.getFontScale()) ? SCALE_EVEN : SCALE_UNEVEN);
} else if (borderScaleSlider.getSlider().equals(source)) {
config.setBorderScale(borderScaleSlider.getScaledValue());
borderScaleSlider.setValueTextColor(((int) config.getBorderScale() == config.getBorderScale()) ? SCALE_EVEN : SCALE_UNEVEN);
} else if (borderInsetXSlider.getSlider().equals(source)) {
config.setBorderInsetX(borderInsetXSlider.getValue());
} else if (borderInsetYSlider.getSlider().equals(source)) {
config.setBorderInsetY(borderInsetYSlider.getValue());
} else if (spaceWidthSlider.getSlider().equals(source)) {
config.setSpaceWidth(spaceWidthSlider.getValue());
} else if (baselineOffsetSlider.getSlider().equals(source)) {
config.setBaselineOffset(baselineOffsetSlider.getValue());
} else if (lineSpacingSlider.getSlider().equals(source)) {
config.setLineSpacing(lineSpacingSlider.getValue());
} else if (charSpacingSlider.getSlider().equals(source)) {
config.setCharSpacing(charSpacingSlider.getValue());
}
chat.repaint();
}
};
ActionListener fontAl = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JMenuItem source = (JMenuItem) e.getSource();
DropdownLabel key = new DropdownLabel(source.getText());
if (CUSTOM_KEY.equals(key)) {
int selectionResult = fontPngPicker.showDialog(ControlWindow.me, "Select Font PNG");
if (selectionResult == JFileChooser.APPROVE_OPTION) {
fontFilenameInput.setText(fontPngPicker.getSelectedFile().getAbsolutePath());
fontPresetDropdown.setSelectedText(fontPngPicker.getSelectedFile().getName());
}
} else {
fontFilenameInput.setText(PRESET_FONT_FILE_MAP.get(key).getFontFilename());
fontTypeCheckbox.setSelected(FontType.VARIABLE_WIDTH.equals(PRESET_FONT_FILE_MAP.get(key).getDefaultType()));
spaceWidthSlider.setEnabled(fontTypeCheckbox.isSelected());
}
updateFontOrBorder(true);
}
};
ActionListener borderAl = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JMenuItem source = (JMenuItem) e.getSource();
DropdownLabel key = new DropdownLabel(source.getText());
if (CUSTOM_KEY.equals(key)) {
int selectionResult = borderPngPicker.showDialog(ControlWindow.me, "Select Border PNG");
if (selectionResult == JFileChooser.APPROVE_OPTION) {
borderFilenameInput.setText(borderPngPicker.getSelectedFile().getAbsolutePath());
borderPresetDropdown.setSelectedText(borderPngPicker.getSelectedFile().getName());
}
} else {
DropdownBorder border = PRESET_BORDER_FILE_MAP.get(key);
borderFilenameInput.setText(border.getBorderFilename());
colorPanel.setBorderColor(border.getDefaultTint());
}
updateFontOrBorder(false);
}
};
fontTypeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
config.setFontType(fontTypeCheckbox.isSelected() ? FontType.VARIABLE_WIDTH : FontType.FIXED_WIDTH);
spaceWidthSlider.setEnabled(fontTypeCheckbox.isSelected());
updateFontOrBorder(true);
}
};
extendedCharBox = new JCheckBox("Display Extended Characters");
extendedCharBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final boolean ecbSelected = extendedCharBox.isSelected();
config.setExtendedCharEnabled(ecbSelected);
unknownCharPopupButton.setEnabled(!ecbSelected);
unknownCharLabel.setEnabled(!ecbSelected);
chat.repaint();
}
});
unknownCharLabel = new JLabel("");
charPicker = new CharacterPicker(ControlWindow.me, fProps.getFontConfig(), unknownCharLabel, chat);
Map<String, List<String>> fontMenuMap = getMenuMapFromPresets(PRESET_FONT_FILE_MAP.keySet());
fontMenuMap.put(CUSTOM_KEY.getLabel(), null);
Map<String, List<String>> borderMenuMap = getMenuMapFromPresets(PRESET_BORDER_FILE_MAP.keySet());
borderMenuMap.put(CUSTOM_KEY.getLabel(), null);
fontTypeCheckbox = new JCheckBox("Variable Width Characters");
fontFilenameInput = new LabeledInput("Font Filename", 32);
fontPresetDropdown = new ComboMenuBar(fontMenuMap, fontAl);
borderFilenameInput = new LabeledInput("Border Filename", 32);
borderPresetDropdown = new ComboMenuBar(borderMenuMap, borderAl);
gridWidthInput = new LabeledInput("Grid Width", 4);
gridHeightInput = new LabeledInput("Grid Height", 4);
fontScaleSlider = new LabeledSlider("Font Scale", "x", ConfigFont.MIN_FONT_SCALE, ConfigFont.MAX_FONT_SCALE, ConfigFont.FONT_BORDER_SCALE_GRANULARITY);
borderScaleSlider = new LabeledSlider("Border Scale", "x", ConfigFont.MIN_BORDER_SCALE, ConfigFont.MAX_BORDER_SCALE, ConfigFont.FONT_BORDER_SCALE_GRANULARITY);
borderInsetXSlider = new LabeledSlider("X", "pixels", ConfigFont.MIN_BORDER_INSET, ConfigFont.MAX_BORDER_INSET);
borderInsetYSlider = new LabeledSlider("Y", "pixels", ConfigFont.MIN_BORDER_INSET, ConfigFont.MAX_BORDER_INSET);
characterKeyInput = new LabeledInput("Character Key", 32);
spaceWidthSlider = new LabeledSlider("Space Width", "%", ConfigFont.MIN_SPACE_WIDTH, ConfigFont.MAX_SPACE_WIDTH);
baselineOffsetSlider = new LabeledSlider("Baseline Height Offset", "pixels", ConfigFont.MIN_BASELINE_OFFSET, ConfigFont.MAX_BASELINE_OFFSET);
lineSpacingSlider = new LabeledSlider("Line Spacing", "pixels", ConfigFont.MIN_LINE_SPACING, ConfigFont.MAX_LINE_SPACING);
charSpacingSlider = new LabeledSlider("Char Spacing", "pixels", ConfigFont.MIN_CHAR_SPACING, ConfigFont.MAX_LINE_SPACING);
unknownCharPopupButton = new JButton("Select Missing Character");
unknownCharPopupButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
charPicker.setVisible(true);
}
});
fontFilenameInput.setEnabled(false);
borderFilenameInput.setEnabled(false);
fontScaleSlider.addChangeListener(sliderListener);
borderScaleSlider.addChangeListener(sliderListener);
borderInsetXSlider.addChangeListener(sliderListener);
borderInsetYSlider.addChangeListener(sliderListener);
spaceWidthSlider.addChangeListener(sliderListener);
baselineOffsetSlider.addChangeListener(sliderListener);
lineSpacingSlider.addChangeListener(sliderListener);
charSpacingSlider.addChangeListener(sliderListener);
JPanel fontPanel = new JPanel(new GridBagLayout());
JPanel borderPanel = new JPanel(new GridBagLayout());
JPanel unknownPanel = new JPanel(new GridBagLayout());
fontPanel.setBorder(new TitledBorder(baseBorder, "Font"));
borderPanel.setBorder(new TitledBorder(baseBorder, "Border"));
unknownPanel.setBorder(new TitledBorder(baseBorder, "Extended and Unicode Characters"));
GridBagConstraints fontGbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, DEFAULT_INSETS, 0, 0);
GridBagConstraints borderGbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, DEFAULT_INSETS, 0, 0);
GridBagConstraints unknownGbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, DEFAULT_INSETS, 0, 0);
// Fields are still used and stored in properties files when saved, but the values are either fixed or meant to
// be filled by other components
// add(fontFilenameInput);
// add(borderFilenameInput);
// add(gridWidthInput);
// add(gridHeightInput);
// add(characterKeyInput);
fontPanel.add(fontPresetDropdown, fontGbc);
fontGbc.gridx++;
// This slider being on the same row as the preset dropdown keeps the combo menu bar from collapsing to no
// height in the layout
fontPanel.add(fontScaleSlider, fontGbc);
fontGbc.gridwidth = 2;
fontGbc.gridx = 0;
fontGbc.gridy++;
fontPanel.add(lineSpacingSlider, fontGbc);
fontGbc.gridy++;
fontPanel.add(charSpacingSlider, fontGbc);
fontGbc.gridy++;
JPanel variableWidthPanel = new JPanel(new GridBagLayout());
GridBagConstraints vwpGbc = getGbc();
vwpGbc.anchor = GridBagConstraints.EAST;
vwpGbc.weightx = 0.0;
vwpGbc.fill = GridBagConstraints.NONE;
variableWidthPanel.add(fontTypeCheckbox, vwpGbc);
vwpGbc.anchor = GridBagConstraints.WEST;
vwpGbc.weightx = 1.0;
vwpGbc.fill = GridBagConstraints.HORIZONTAL;
vwpGbc.gridx++;
variableWidthPanel.add(spaceWidthSlider, vwpGbc);
fontPanel.add(variableWidthPanel, fontGbc);
fontGbc.gridy++;
fontPanel.add(baselineOffsetSlider, fontGbc);
fontGbc.gridy++;
borderPanel.add(borderPresetDropdown, borderGbc);
borderGbc.gridx++;
// This slider being on the same row as the preset dropdown keeps the combo menu bar from collapsing to no
// height in the layout
borderPanel.add(borderScaleSlider, borderGbc);
borderGbc.gridwidth = 2;
borderGbc.gridx = 0;
borderGbc.gridy++;
borderGbc.anchor = GridBagConstraints.CENTER;
borderPanel.add(new JLabel("Font Insets Off Border"), borderGbc);
borderGbc.gridy++;
borderPanel.add(borderInsetXSlider, borderGbc);
borderGbc.gridy++;
borderPanel.add(borderInsetYSlider, borderGbc);
borderGbc.gridy++;
unknownPanel.add(extendedCharBox, unknownGbc);
unknownGbc.gridx++;
unknownPanel.add(unknownCharPopupButton, unknownGbc);
unknownGbc.gridx++;
unknownPanel.add(unknownCharLabel, unknownGbc);
unknownGbc.gridx++;
JPanel everything = new JPanel(new GridBagLayout());
GridBagConstraints eGbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, DEFAULT_INSETS, 10, 10);
everything.add(fontPanel, eGbc);
eGbc.gridy++;
everything.add(borderPanel, eGbc);
eGbc.gridy++;
everything.add(unknownPanel, eGbc);
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.CENTER;
gbc.weightx = 1.0;
gbc.weighty = 0.0;
add(everything, gbc);
// Filler panel
gbc.gridy++;
gbc.weighty = 1.0;
gbc.anchor = GridBagConstraints.SOUTH;
add(new JPanel(), gbc);
}
use of javax.swing.border.TitledBorder in project adempiere by adempiere.
the class VBOMDrop method createMainPanel.
// getInvoices
/**************************************************************************
* Create Main Panel.
* Called when changing Product
*/
private void createMainPanel() {
log.config(": " + m_product);
this.removeAll();
this.setPreferredSize(null);
this.invalidate();
this.setBorder(null);
//
m_selectionList.clear();
m_productList.clear();
m_qtyList.clear();
m_buttonGroups.clear();
//
this.setLayout(new ALayout());
String title = Msg.getMsg(Env.getCtx(), "SelectProduct");
if (m_product != null && m_product.get_ID() > 0) {
title = m_product.getName();
if (m_product.getDescription() != null && m_product.getDescription().length() > 0)
this.setToolTipText(m_product.getDescription());
m_bomLine = 0;
addBOMLines(m_product, m_qty);
}
this.setBorder(new TitledBorder(title));
}
use of javax.swing.border.TitledBorder in project adempiere by adempiere.
the class VCharge method jbInit.
/**
* Static Init
* @throws Exception
*/
private void jbInit() throws Exception {
CompiereColor.setBackground(panel);
newBorder = new TitledBorder("");
accountBorder = new TitledBorder("");
mainPanel.setLayout(mainLayout);
newPanel.setBorder(newBorder);
newPanel.setLayout(newLayout);
newBorder.setTitle(Msg.getMsg(Env.getCtx(), "ChargeNewAccount"));
valueLabel.setText(Msg.translate(Env.getCtx(), "Value"));
isExpense.setSelected(true);
isExpense.setText(Msg.getMsg(Env.getCtx(), "Expense"));
nameLabel.setText(Msg.translate(Env.getCtx(), "Name"));
nameField.setColumns(20);
valueField.setColumns(10);
newButton.setText(Msg.getMsg(Env.getCtx(), "Create") + " " + Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")));
newButton.addActionListener(this);
accountPanel.setBorder(accountBorder);
accountPanel.setLayout(accountLayout);
accountBorder.setTitle(Msg.getMsg(Env.getCtx(), "ChargeFromAccount"));
accountButton.setText(Msg.getMsg(Env.getCtx(), "Create") + " " + Msg.getMsg(Env.getCtx(), "From") + " " + Msg.getElement(Env.getCtx(), "Account_ID"));
accountButton.addActionListener(this);
accountOKPanel.setLayout(accountOKLayout);
accountOKLayout.setAlignment(FlowLayout.RIGHT);
confirmPanel.addActionListener(this);
//
mainPanel.add(newPanel, BorderLayout.NORTH);
newPanel.add(valueLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
newPanel.add(valueField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
newPanel.add(nameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
newPanel.add(nameField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
newPanel.add(isExpense, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
newPanel.add(newButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
mainPanel.add(accountPanel, BorderLayout.CENTER);
accountPanel.add(accountOKPanel, BorderLayout.SOUTH);
accountOKPanel.add(accountButton, null);
accountPanel.add(dataPane, BorderLayout.CENTER);
dataPane.getViewport().add(dataTable, null);
}
Aggregations