Search in sources :

Example 1 with Border

use of javax.swing.border.Border in project groovy by apache.

the class LexerFrame method jbInit.

private void jbInit(Reader reader) throws Exception {
    final Border border = BorderFactory.createEmptyBorder();
    jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
    tokenPane.setEditable(false);
    tokenPane.setText("");
    scriptPane.setFont(new java.awt.Font("DialogInput", 0, 12));
    scriptPane.setEditable(false);
    scriptPane.setMargin(new Insets(5, 5, 5, 5));
    scriptPane.setText("");
    jScrollPane1.setBorder(border);
    jScrollPane2.setBorder(border);
    jSplitPane1.setMinimumSize(new Dimension(800, 600));
    mainPanel.add(jSplitPane1, BorderLayout.CENTER);
    if (reader == null) {
        mainPanel.add(jbutton, BorderLayout.NORTH);
    }
    this.getContentPane().add(mainPanel);
    jSplitPane1.add(jScrollPane1, JSplitPane.LEFT);
    jScrollPane1.getViewport().add(tokenPane, null);
    jSplitPane1.add(jScrollPane2, JSplitPane.RIGHT);
    jScrollPane2.getViewport().add(scriptPane, null);
    jScrollPane1.setColumnHeaderView(new JLabel(" Token Stream:"));
    jScrollPane2.setColumnHeaderView(new JLabel(" Input Script:"));
    jSplitPane1.setResizeWeight(0.5);
}
Also used : Border(javax.swing.border.Border) java.awt(java.awt)

Example 2 with Border

use of javax.swing.border.Border in project pcgen by PCGen.

the class SummaryInfoTab method highlightBorder.

private void highlightBorder(final JComponent comp) {
    final Border oldBorder = comp.getBorder();
    Border highlightBorder = BorderFactory.createLineBorder(Color.GREEN, 3);
    comp.setBorder(highlightBorder);
    SwingUtilities.invokeLater(() -> {
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
        // Ignored as we'll exit shortly anyway.
        }
        comp.setBorder(oldBorder);
    });
}
Also used : Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder)

Example 3 with Border

use of javax.swing.border.Border in project pcgen by PCGen.

the class CharacterStatsPanel method initComponents.

/**
	 * Build and initialise the user interface.
	 */
private void initComponents() {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    JLabel label;
    ButtonGroup exclusiveGroup;
    Border etched = null;
    TitledBorder title1 = BorderFactory.createTitledBorder(etched, in_abilities);
    title1.setTitleJustification(TitledBorder.LEFT);
    this.setBorder(title1);
    this.setLayout(gridbag);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(2, 2, 2, 2);
    final GameMode gameMode = SettingsHandler.getGame();
    int row = 0;
    exclusiveGroup = new ButtonGroup();
    Utility.buildConstraints(c, 0, row++, 3, 1, 0, 0);
    label = new JLabel(LanguageBundle.getFormattedString("in_Prefs_abilitiesGenLabel", //$NON-NLS-1$
    gameMode.getDisplayName()));
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 0, row, 1, 1, 0, 0);
    label = new JLabel("  ");
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 1, row++, 2, 1, 0, 0);
    abilitiesUserRolledButton = new JRadioButton(LanguageBundle.getString("in_Prefs_abilitiesUserRolled"));
    gridbag.setConstraints(abilitiesUserRolledButton, c);
    this.add(abilitiesUserRolledButton);
    exclusiveGroup.add(abilitiesUserRolledButton);
    Utility.buildConstraints(c, 1, row++, 2, 1, 0, 0);
    abilitiesAllSameButton = new JRadioButton(LanguageBundle.getString("in_Prefs_abilitiesAllSame") + ": ");
    gridbag.setConstraints(abilitiesAllSameButton, c);
    this.add(abilitiesAllSameButton);
    exclusiveGroup.add(abilitiesAllSameButton);
    Utility.buildConstraints(c, 1, row, 1, 1, 0, 0);
    label = new JLabel("  ");
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 2, row++, 2, 1, 0, 0);
    abilityScoreCombo = new JComboBoxEx();
    for (int i = gameMode.getStatMin(); i <= gameMode.getStatMax(); ++i) {
        abilityScoreCombo.addItem(String.valueOf(i));
    }
    gridbag.setConstraints(abilityScoreCombo, c);
    this.add(abilityScoreCombo);
    ReferenceManufacturer<RollMethod> mfg = gameMode.getModeContext().getReferenceContext().getManufacturer(RollMethod.class);
    List<RollMethod> rollMethods = mfg.getOrderSortedObjects();
    if (!rollMethods.isEmpty()) {
        Utility.buildConstraints(c, 1, row++, 2, 1, 0, 0);
        abilitiesRolledButton = new JRadioButton("Rolled:");
        gridbag.setConstraints(abilitiesRolledButton, c);
        this.add(abilitiesRolledButton);
        exclusiveGroup.add(abilitiesRolledButton);
        Utility.buildConstraints(c, 2, row++, 2, 1, 0, 0);
        abilityRolledModeCombo = new JComboBoxEx();
        for (RollMethod rm : rollMethods) {
            abilityRolledModeCombo.addItem(rm.getDisplayName());
        }
        gridbag.setConstraints(abilityRolledModeCombo, c);
        this.add(abilityRolledModeCombo);
    }
    Collection<PointBuyMethod> methods = SettingsHandler.getGame().getModeContext().getReferenceContext().getConstructedCDOMObjects(PointBuyMethod.class);
    final int purchaseMethodCount = methods.size();
    Utility.buildConstraints(c, 1, row++, 2, 1, 0, 0);
    abilitiesPurchasedButton = new JRadioButton(LanguageBundle.getString("in_Prefs_abilitiesPurchased") + ": ");
    gridbag.setConstraints(abilitiesPurchasedButton, c);
    this.add(abilitiesPurchasedButton);
    exclusiveGroup.add(abilitiesPurchasedButton);
    Utility.buildConstraints(c, 2, row++, 2, 1, 0, 0);
    pMode = new String[purchaseMethodCount];
    pModeMethodName = new String[purchaseMethodCount];
    int i = 0;
    for (PointBuyMethod pbm : methods) {
        pMode[i] = pbm.getDescription();
        pModeMethodName[i] = pbm.getDisplayName();
        i++;
    }
    abilityPurchaseModeCombo = new JComboBoxEx(pMode);
    gridbag.setConstraints(abilityPurchaseModeCombo, c);
    this.add(abilityPurchaseModeCombo);
    //
    if (purchaseMethodCount == 0) {
        abilityPurchaseModeCombo.setVisible(false);
        abilitiesPurchasedButton.setVisible(false);
    }
    Utility.buildConstraints(c, 1, row++, 1, 1, 0, 0);
    label = new JLabel(" ");
    gridbag.setConstraints(label, c);
    this.add(label);
    Utility.buildConstraints(c, 1, row++, 3, 1, 0, 0);
    JButton purchaseModeButton = new JButton(LanguageBundle.getString("in_Prefs_purchaseModeConfig"));
    gridbag.setConstraints(purchaseModeButton, c);
    this.add(purchaseModeButton);
    purchaseModeButton.addActionListener(new PurchaseModeButtonListener());
    Utility.buildConstraints(c, 5, 20, 1, 1, 1, 1);
    c.fill = GridBagConstraints.BOTH;
    label = new JLabel(" ");
    gridbag.setConstraints(label, c);
    this.add(label);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) RollMethod(pcgen.cdom.content.RollMethod) GridBagLayout(java.awt.GridBagLayout) PointBuyMethod(pcgen.core.PointBuyMethod) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) TitledBorder(javax.swing.border.TitledBorder) GameMode(pcgen.core.GameMode) ButtonGroup(javax.swing.ButtonGroup) JComboBoxEx(pcgen.gui2.util.JComboBoxEx) Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder)

Example 4 with Border

use of javax.swing.border.Border in project pcgen by PCGen.

the class Utils method buildFloatField.

/**
	 * <p>Builds a formatted text field with specified min and max</p>
	 * 
	 * @param min minimum value
	 * @param max maximum value
	 * @return JFormattedTextField
	 */
public static JFormattedTextField buildFloatField(float min, float max) {
    java.text.NumberFormat numberFormat = java.text.NumberFormat.getNumberInstance();
    // numberFormat.setParseIntegerOnly(false);
    NumberFormatter formatter = new NumberFormatter(numberFormat);
    //formatter.getCommitsOnValidEdit();
    formatter.setMinimum(min);
    formatter.setMaximum(max);
    final JFormattedTextField returnValue = new JFormattedTextField(formatter);
    returnValue.setColumns(4);
    returnValue.addPropertyChangeListener(new PropertyChangeListener() {

        Border m_originalBorder = returnValue.getBorder();

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName() != null && evt.getPropertyName().equals("editValid")) {
                if (evt.getNewValue() != null && evt.getNewValue() instanceof Boolean) {
                    if (((Boolean) evt.getNewValue()).booleanValue()) {
                        returnValue.setBorder(m_originalBorder);
                    } else {
                        returnValue.setBorder(BorderFactory.createLineBorder(Color.red));
                    }
                }
            }
        }
    });
    return returnValue;
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) JFormattedTextField(javax.swing.JFormattedTextField) Border(javax.swing.border.Border) NumberFormatter(javax.swing.text.NumberFormatter)

Example 5 with Border

use of javax.swing.border.Border in project EnrichmentMapApp by BaderLab.

the class ColorRenderer method getTableCellRendererComponent.

public JLabel getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    JLabel label = new JLabel();
    //MUST do this for background to show up.
    label.setOpaque(true);
    HeatMapTableModel model = (HeatMapTableModel) table.getModel();
    EMDataSet dataset = model.getDataSet(col);
    Transform transform = model.getTransform();
    DataSetColorRange range = getRange(dataset, transform);
    if (value instanceof Double) {
        Color color = getColor(range.getTheme(), range.getRange(), (Double) value);
        label.setBackground(color);
        Border border = BorderFactory.createMatteBorder(1, 1, 1, 1, isSelected ? table.getSelectionForeground() : color);
        label.setBorder(border);
        if (Double.isFinite((Double) value))
            label.setToolTipText(value.toString());
    }
    return label;
}
Also used : Color(java.awt.Color) JLabel(javax.swing.JLabel) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) Transform(org.baderlab.csplugins.enrichmentmap.view.heatmap.HeatMapParams.Transform) Border(javax.swing.border.Border)

Aggregations

Border (javax.swing.border.Border)345 JPanel (javax.swing.JPanel)111 JLabel (javax.swing.JLabel)92 Insets (java.awt.Insets)74 JScrollPane (javax.swing.JScrollPane)68 GridBagConstraints (java.awt.GridBagConstraints)65 GridBagLayout (java.awt.GridBagLayout)64 EmptyBorder (javax.swing.border.EmptyBorder)64 Dimension (java.awt.Dimension)58 BorderLayout (java.awt.BorderLayout)57 JButton (javax.swing.JButton)56 ActionEvent (java.awt.event.ActionEvent)50 TitledBorder (javax.swing.border.TitledBorder)48 ActionListener (java.awt.event.ActionListener)41 BoxLayout (javax.swing.BoxLayout)39 EtchedBorder (javax.swing.border.EtchedBorder)39 JTextField (javax.swing.JTextField)35 CompoundBorder (javax.swing.border.CompoundBorder)34 FlowLayout (java.awt.FlowLayout)33 JCheckBox (javax.swing.JCheckBox)29