use of javax.swing.border.EtchedBorder in project narchy by automenta.
the class TestbedSidePanel method initComponents.
public void initComponents() {
setLayout(new BorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
TestbedSettings settings = model.getSettings();
JPanel top = new JPanel();
top.setLayout(new GridLayout(0, 1));
top.setBorder(BorderFactory.createCompoundBorder(new EtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(10, 10, 10, 10)));
tests = new JComboBox(model.getComboModel());
tests.setMaximumRowCount(30);
tests.setMaximumSize(new Dimension(250, 20));
tests.addActionListener(this);
tests.setRenderer(new ListCellRenderer() {
JLabel categoryLabel = null;
JLabel testLabel = null;
@Override
public Component getListCellRendererComponent(JList list, Object ovalue, int index, boolean isSelected, boolean cellHasFocus) {
ListItem value = (ListItem) ovalue;
if (value.isCategory()) {
if (categoryLabel == null) {
categoryLabel = new JLabel();
categoryLabel.setOpaque(true);
categoryLabel.setBackground(new Color(.5f, .5f, .6f));
categoryLabel.setForeground(Color.white);
categoryLabel.setHorizontalAlignment(SwingConstants.CENTER);
categoryLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
}
categoryLabel.setText(value.category);
return categoryLabel;
} else {
if (testLabel == null) {
testLabel = new JLabel();
testLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 1, 0));
}
testLabel.setText(value.test.getTestName());
if (isSelected) {
testLabel.setBackground(list.getSelectionBackground());
testLabel.setForeground(list.getSelectionForeground());
} else {
testLabel.setBackground(list.getBackground());
testLabel.setForeground(list.getForeground());
}
return testLabel;
}
}
});
top.add(new JLabel("Choose a test:"));
top.add(tests);
addSettings(top, settings, SettingType.DRAWING);
add(top, "North");
JPanel middle = new JPanel();
middle.setLayout(new GridLayout(0, 1));
middle.setBorder(BorderFactory.createCompoundBorder(new EtchedBorder(EtchedBorder.LOWERED), BorderFactory.createEmptyBorder(5, 10, 5, 10)));
addSettings(middle, settings, SettingType.ENGINE);
add(middle, "Center");
pauseButton.setAlignmentX(CENTER_ALIGNMENT);
stepButton.setAlignmentX(CENTER_ALIGNMENT);
resetButton.setAlignmentX(CENTER_ALIGNMENT);
saveButton.setAlignmentX(CENTER_ALIGNMENT);
loadButton.setAlignmentX(CENTER_ALIGNMENT);
quitButton.setAlignmentX(CENTER_ALIGNMENT);
Box buttonGroups = Box.createHorizontalBox();
JPanel buttons1 = new JPanel();
buttons1.setLayout(new GridLayout(0, 1));
buttons1.add(resetButton);
JPanel buttons2 = new JPanel();
buttons2.setLayout(new GridLayout(0, 1));
buttons2.add(pauseButton);
buttons2.add(stepButton);
JPanel buttons3 = new JPanel();
buttons3.setLayout(new GridLayout(0, 1));
buttons3.add(saveButton);
buttons3.add(loadButton);
buttons3.add(quitButton);
buttonGroups.add(buttons1);
buttonGroups.add(buttons2);
buttonGroups.add(buttons3);
add(buttonGroups, "South");
}
use of javax.swing.border.EtchedBorder in project airavata by apache.
the class WorkflowImportWindow method initGUI.
/**
* Initializes the GUI
*/
private void initGUI() {
this.list = new XbayaEnhancedList<RegistrySearchResult>();
this.list.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() >= 2) {
// double click is same as cliking the OK button.
WorkflowImportWindow.this.okButton.doClick();
}
if (WorkflowImportWindow.this.list.getSelectedIndex() == -1) {
WorkflowImportWindow.this.okButton.setEnabled(false);
WorkflowImportWindow.this.deleteButton.setEnabled(false);
} else {
WorkflowImportWindow.this.okButton.setEnabled(true);
WorkflowImportWindow.this.deleteButton.setEnabled(true);
}
// if (WorkflowImportWindow.this.list.getSelectedIndex() == 2) {
// WorkflowImportWindow.this.okButton.setEnabled(false);
// WorkflowImportWindow.this.deleteButton.setEnabled(true);
// } else if (WorkflowImportWindow.this.list.getSelectedIndex() != 1) {
// WorkflowImportWindow.this.okButton.setEnabled(true);
// WorkflowImportWindow.this.deleteButton.setEnabled(true);
// } else {
// WorkflowImportWindow.this.okButton.setEnabled(false);
// WorkflowImportWindow.this.deleteButton.setEnabled(false);
// }
}
});
GridPanel mainPanel = new GridPanel();
TitledBorder border = new TitledBorder(new EtchedBorder(), "Select a workflow to load");
mainPanel.getSwingComponent().setBorder(border);
mainPanel.add(this.list);
mainPanel.layout(1, 1, 0, 0);
JPanel buttonPanel = new JPanel();
this.okButton = new JButton("Load");
this.okButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
ok();
}
});
buttonPanel.add(this.okButton);
this.deleteButton = new JButton("Delete");
this.deleteButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
delete();
}
});
buttonPanel.add(this.deleteButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
buttonPanel.add(cancelButton);
this.dialog = new XBayaDialog(this.engine.getGUI(), "Load a Workflow from the Registry", mainPanel, buttonPanel);
this.dialog.setDefaultButton(this.okButton);
}
use of javax.swing.border.EtchedBorder in project airavata by apache.
the class RegistryWorkflowPublisherWindow method initGUI.
/**
* Intialize UI
*/
private void initGUI() {
this.nameTextField = new XBayaTextField();
XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
this.descriptionTextArea = new XBayaTextArea();
XBayaLabel descriptionLabel = new XBayaLabel("Description", this.descriptionTextArea);
JPanel buttonPanel = new JPanel();
this.okButton = new JButton("OK");
this.okButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
ok();
}
});
buttonPanel.add(this.okButton);
GridPanel mainPanel = new GridPanel();
TitledBorder border = new TitledBorder(new EtchedBorder(), "Save Workflow to Registry");
mainPanel.getSwingComponent().setBorder(border);
mainPanel.add(nameLabel);
mainPanel.add(this.nameTextField);
mainPanel.add(descriptionLabel);
mainPanel.add(this.descriptionTextArea);
chkMakePublic = new JCheckBox("Make public");
mainPanel.add(chkMakePublic);
mainPanel.layout(2, 2, 0, 0);
this.dialog = new XBayaDialog(this.engine.getGUI(), "Save Workflow to Registry", mainPanel, buttonPanel);
this.dialog.setDefaultButton(this.okButton);
}
use of javax.swing.border.EtchedBorder in project dwoss by gg-net.
the class DocumentStringRenderer method getListCellRendererComponent.
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
setBorder(new EtchedBorder(1, new Color(204, 204, 255), Color.BLACK));
Document doc = ((Document) value);
switch(doc.getType()) {
case ORDER:
label.setText(!doc.getDossier().getActiveDocuments(DocumentType.INVOICE).isEmpty() ? "<html>" + toHtmlSimple(doc, false) + "</html>" : "<html>" + toHtmlDetailed(doc, doc.getTaxType() != GlobalConfig.DEFAULT_TAX) + "</html>");
break;
case COMPLAINT:
label.setText(!doc.getDossier().getActiveDocuments(DocumentType.CREDIT_MEMO).isEmpty() || !doc.getDossier().getActiveDocuments(DocumentType.ANNULATION_INVOICE).isEmpty() ? "<html>" + toHtmlSimple(doc, false) + "</html>" : "<html>" + toHtmlDetailed(doc, doc.getTaxType() != GlobalConfig.DEFAULT_TAX) + "</html>");
break;
case INVOICE:
case BLOCK:
case CREDIT_MEMO:
case RETURNS:
case ANNULATION_INVOICE:
case CAPITAL_ASSET:
label.setText("<html>" + toHtmlDetailed(doc, doc.getTaxType() != GlobalConfig.DEFAULT_TAX) + "</html>");
}
if (!isSelected) {
if (((Document) value).getFlags().contains(Document.Flag.CUSTOMER_EXACTLY_BRIEFED)) {
label.setBackground(Color.GREEN);
label.setForeground(Color.BLACK);
} else if (((Document) value).getFlags().contains(Document.Flag.CUSTOMER_BRIEFED)) {
label.setBackground(Color.YELLOW);
label.setForeground(Color.BLACK);
} else {
label.setBackground(Color.white);
label.setForeground(Color.BLACK);
}
}
return label;
}
use of javax.swing.border.EtchedBorder in project antlrworks by antlr.
the class NewWizardDialog method initComponents.
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license - Ryan Paul Talusan
dialogPane = new JPanel();
contentPanel = new JPanel();
label1 = new JLabel();
grammarNameField = new JTextField();
label2 = new JLabel();
grammarTypeComboBox = new JComboBox();
lexicalItemPanel = new JPanel();
lexLeftPanel = new JPanel();
cbIdentifier = new JCheckBox();
cbInteger = new JCheckBox();
cbFloat = new JCheckBox();
cbComments = new JCheckBox();
commentsPanel = new JPanel();
cbSingleLine = new JCheckBox();
cbMultiLine = new JCheckBox();
lexRightPanel = new JPanel();
cbString = new JCheckBox();
stringPanel = new JPanel();
singleQuoteRadio = new JRadioButton();
doubleQuoteRadio = new JRadioButton();
cbCharacters = new JCheckBox();
cbWhiteSpace = new JCheckBox();
wsPanel = new JPanel();
cbTabChar = new JCheckBox();
cbNewlineChar = new JCheckBox();
cbCarriageReturnChar = new JCheckBox();
buttonBar = new JPanel();
okButton = new JButton();
cancelButton = new JButton();
CellConstraints cc = new CellConstraints();
// ======== this ========
setTitle("New Grammar Wizard");
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
// ======== dialogPane ========
{
dialogPane.setBorder(Borders.DIALOG_BORDER);
dialogPane.setLayout(new BorderLayout());
// ======== contentPanel ========
{
contentPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.RIGHT, Sizes.DEFAULT, FormSpec.NO_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.UNRELATED_GAP_ROWSPEC, new RowSpec(RowSpec.TOP, Sizes.DEFAULT, RowSpec.DEFAULT_GROW) }));
// ---- label1 ----
label1.setText("Grammar Name:");
contentPanel.add(label1, cc.xy(3, 1));
contentPanel.add(grammarNameField, cc.xywh(5, 1, 3, 1));
// ---- label2 ----
label2.setText("Type:");
contentPanel.add(label2, cc.xy(3, 3));
// ---- grammarTypeComboBox ----
grammarTypeComboBox.setModel(new DefaultComboBoxModel(new String[] { "Parser", "Lexer", "Tree Grammar", "Combined Grammar" }));
grammarTypeComboBox.setSelectedIndex(3);
grammarTypeComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
switch(grammarTypeComboBox.getSelectedIndex()) {
case GRAMMAR_TYPE_PARSER:
case GRAMMAR_TYPE_TREE_GRAMMAR:
cbIdentifier.setEnabled(false);
cbInteger.setEnabled(false);
cbFloat.setEnabled(false);
cbComments.setEnabled(false);
cbSingleLine.setEnabled(false);
cbMultiLine.setEnabled(false);
cbString.setEnabled(false);
cbCharacters.setEnabled(false);
cbWhiteSpace.setEnabled(false);
cbTabChar.setEnabled(false);
cbNewlineChar.setEnabled(false);
cbCarriageReturnChar.setEnabled(false);
break;
case GRAMMAR_TYPE_LEXER:
case GRAMMAR_TYPE_COMBINED_GRAMMAR:
cbIdentifier.setEnabled(true);
cbInteger.setEnabled(true);
cbFloat.setEnabled(true);
cbComments.setEnabled(true);
if (cbComments.isSelected()) {
cbSingleLine.setEnabled(true);
cbMultiLine.setEnabled(true);
}
cbString.setEnabled(true);
cbCharacters.setEnabled(true);
cbWhiteSpace.setEnabled(true);
if (cbWhiteSpace.isSelected()) {
cbTabChar.setEnabled(true);
cbNewlineChar.setEnabled(true);
cbCarriageReturnChar.setEnabled(true);
}
break;
}
}
});
contentPanel.add(grammarTypeComboBox, cc.xy(5, 3));
// ======== lexicalItemPanel ========
{
lexicalItemPanel.setBorder(new TitledBorder(null, "Lexical Items", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION));
lexicalItemPanel.setLayout(new FormLayout(new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { new RowSpec(RowSpec.TOP, Sizes.DEFAULT, RowSpec.DEFAULT_GROW) }));
// ======== lexLeftPanel ========
{
lexLeftPanel.setLayout(new FormLayout(new ColumnSpec[] { new ColumnSpec(ColumnSpec.DEFAULT, Sizes.dluX(10), FormSpec.NO_GROW), new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
// ---- cbIdentifier ----
cbIdentifier.setText("Identifier");
lexLeftPanel.add(cbIdentifier, cc.xywh(1, 1, 2, 1));
// ---- cbInteger ----
cbInteger.setText("Integer");
lexLeftPanel.add(cbInteger, cc.xywh(1, 3, 2, 1));
// ---- cbFloat ----
cbFloat.setText("Float");
lexLeftPanel.add(cbFloat, cc.xywh(1, 5, 2, 1));
// ---- cbComments ----
cbComments.setText("Comments");
lexLeftPanel.add(cbComments, cc.xywh(1, 7, 2, 1));
cbComments.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (cbComments.isSelected()) {
cbSingleLine.setEnabled(true);
cbMultiLine.setEnabled(true);
} else {
cbSingleLine.setEnabled(false);
cbMultiLine.setEnabled(false);
}
}
});
// ======== commentsPanel ========
{
commentsPanel.setBorder(new TitledBorder(null, null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION));
commentsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
// ---- cbSingleLine ----
cbSingleLine.setText("Single-line ( //... )");
cbSingleLine.setEnabled(false);
cbSingleLine.setSelected(true);
commentsPanel.add(cbSingleLine, cc.xy(1, 1));
cbSingleLine.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (!cbSingleLine.isSelected() && !cbMultiLine.isSelected()) {
cbComments.setSelected(false);
cbSingleLine.setEnabled(false);
cbMultiLine.setEnabled(false);
cbSingleLine.setSelected(true);
cbMultiLine.setSelected(true);
}
}
});
// ---- cbMultiLine ----
cbMultiLine.setText("Multi-line ( /* .. */ )");
cbMultiLine.setEnabled(false);
cbMultiLine.setSelected(true);
commentsPanel.add(cbMultiLine, cc.xy(1, 3));
cbMultiLine.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (!cbSingleLine.isSelected() && !cbMultiLine.isSelected()) {
cbComments.setSelected(false);
cbSingleLine.setEnabled(false);
cbMultiLine.setEnabled(false);
cbSingleLine.setSelected(true);
cbMultiLine.setSelected(true);
}
}
});
}
lexLeftPanel.add(commentsPanel, cc.xy(2, 9));
}
lexicalItemPanel.add(lexLeftPanel, cc.xy(1, 1));
// ======== lexRightPanel ========
{
lexRightPanel.setLayout(new FormLayout(new ColumnSpec[] { new ColumnSpec(ColumnSpec.DEFAULT, Sizes.dluX(10), FormSpec.NO_GROW), new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
// ---- cbString ----
cbString.setText("String");
lexRightPanel.add(cbString, cc.xywh(1, 1, 2, 1));
cbString.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
if (cbString.isSelected()) {
singleQuoteRadio.setEnabled(true);
doubleQuoteRadio.setEnabled(true);
} else {
singleQuoteRadio.setEnabled(false);
doubleQuoteRadio.setEnabled(false);
}
}
});
// ======== stringPanel ========
{
stringPanel.setBorder(new EtchedBorder());
stringPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
// ---- singleQuoteRadio ----
singleQuoteRadio.setText("Single quotes ( 'sample string' )");
singleQuoteRadio.setEnabled(false);
stringPanel.add(singleQuoteRadio, cc.xy(1, 1));
// ---- doubleQuoteRadio ----
doubleQuoteRadio.setText("Double quotes ( \"sample string\" )");
doubleQuoteRadio.setEnabled(false);
doubleQuoteRadio.setSelected(true);
stringPanel.add(doubleQuoteRadio, cc.xy(1, 3));
}
lexRightPanel.add(stringPanel, cc.xy(2, 3));
// ---- cbCharacters ----
cbCharacters.setText("Character");
lexRightPanel.add(cbCharacters, cc.xywh(1, 5, 2, 1));
// ---- cbWhiteSpace ----
cbWhiteSpace.setText("White Space");
lexRightPanel.add(cbWhiteSpace, cc.xywh(1, 7, 3, 1));
// ======== wsPanel ========
{
wsPanel.setBorder(new EtchedBorder());
wsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
// ---- cbTabChar ----
cbTabChar.setText("Tab character ( /t )");
cbTabChar.setEnabled(false);
cbTabChar.setSelected(true);
wsPanel.add(cbTabChar, cc.xy(1, 1));
// ---- cbNewlineChar ----
cbNewlineChar.setText("Newline character ( /n )");
cbNewlineChar.setEnabled(false);
cbNewlineChar.setSelected(true);
wsPanel.add(cbNewlineChar, cc.xy(1, 3));
// ---- cbCarriageReturnChar ----
cbCarriageReturnChar.setText("Carriage-return character ( /r )");
cbCarriageReturnChar.setEnabled(false);
cbCarriageReturnChar.setSelected(true);
wsPanel.add(cbCarriageReturnChar, cc.xy(1, 5));
}
lexRightPanel.add(wsPanel, cc.xy(2, 9));
}
lexicalItemPanel.add(lexRightPanel, cc.xy(3, 1));
}
contentPanel.add(lexicalItemPanel, cc.xywh(3, 5, 5, 1));
}
dialogPane.add(contentPanel, BorderLayout.CENTER);
// ======== buttonBar ========
{
buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
buttonBar.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref")));
// ---- okButton ----
okButton.setText("OK");
buttonBar.add(okButton, cc.xy(2, 1));
// ---- cancelButton ----
cancelButton.setText("Cancel");
buttonBar.add(cancelButton, cc.xy(4, 1));
}
dialogPane.add(buttonBar, BorderLayout.SOUTH);
}
contentPane.add(dialogPane, BorderLayout.CENTER);
pack();
// ---- buttonGroup1 ----
ButtonGroup buttonGroup1 = new ButtonGroup();
buttonGroup1.add(singleQuoteRadio);
buttonGroup1.add(doubleQuoteRadio);
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
Aggregations