Search in sources :

Example 11 with LineBorder

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

the class JIcon method initComponents.

/**
	 *  This method is called from within the constructor to initialize the form.
	 *  WARNING: Do NOT modify this code. The content of this method is always
	 *  regenerated by the Form Editor.
	 */
private void initComponents() {
    contextMenu = new JPopupMenu();
    JMenuItem launchMI = new JMenuItem();
    deleteMI = new JMenuItem();
    button = new JButton();
    label = new JLabel();
    launchMI.setText("Launch File (enter)");
    launchMI.addActionListener(this::launchMIActionPerformed);
    contextMenu.add(launchMI);
    deleteMI.setText("Delete File (del)");
    deleteMI.addActionListener(this::deleteMIActionPerformed);
    contextMenu.add(deleteMI);
    setLayout(new BorderLayout());
    setBackground((Color) UIManager.getDefaults().get("Panel.background"));
    setBorder(new LineBorder(new Color(0, 0, 0)));
    button.setBackground((Color) UIManager.getDefaults().get("Button.background"));
    button.setBorder(null);
    button.addActionListener(this::buttonActionPerformed);
    button.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent evt) {
            buttonFocusGained(evt);
        }

        @Override
        public void focusLost(FocusEvent evt) {
            buttonFocusLost(evt);
        }
    });
    button.addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent evt) {
            buttonKeyReleased(evt);
        }
    });
    button.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent evt) {
            buttonMouseClicked(evt);
        }

        @Override
        public void mouseReleased(MouseEvent evt) {
            buttonMouseReleased(evt);
        }
    });
    add(button, BorderLayout.NORTH);
    label.setBackground(new Color(204, 204, 204));
    add(label, BorderLayout.CENTER);
}
Also used : LineBorder(javax.swing.border.LineBorder) Color(java.awt.Color) SystemColor(java.awt.SystemColor) BorderLayout(java.awt.BorderLayout)

Example 12 with LineBorder

use of javax.swing.border.LineBorder in project intellij-community by JetBrains.

the class DataFrameTableCellRenderer method getTableCellRendererComponent.

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
    if (value != null) {
        setText(value.toString());
    }
    if (!(value instanceof TableValueDescriptor)) {
        return this;
    }
    TableValueDescriptor descriptor = (TableValueDescriptor) value;
    if (hasFocus) {
        this.setBorder(new LineBorder(JBColor.BLUE, 2));
    }
    if (myColored) {
        try {
            double rangedValue = descriptor.getRangedValue();
            if (!Double.isNaN(rangedValue)) {
                this.setBackground(PyNumericViewUtil.rangedValueToColor(rangedValue));
            }
        } catch (NumberFormatException ignored) {
        }
    } else {
        this.setBackground(new JBColor(UIUtil.getBgFillColor(table), UIUtil.getBgFillColor(table)));
    }
    return this;
}
Also used : LineBorder(javax.swing.border.LineBorder) JBColor(com.intellij.ui.JBColor)

Example 13 with LineBorder

use of javax.swing.border.LineBorder in project ACS by ACS-Community.

the class ButtonEditor method createButton.

private JButton createButton() {
    if (propertyEnv == null) {
        throw new RuntimeException("propertyEnv variable not yet initialized");
    }
    JButton jb = new JButton(propertyEnv.getFeatureDescriptor().getDisplayName());
    jb.setHorizontalTextPosition(JLabel.CENTER);
    jb.setHorizontalAlignment(JLabel.CENTER);
    jb.setBorder(new LineBorder(Color.gray));
    jb.setOpaque(false);
    jb.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            handleButtonClick(e);
        }
    });
    return jb;
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) LineBorder(javax.swing.border.LineBorder) JButton(javax.swing.JButton)

Example 14 with LineBorder

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

the class PopupDaemon method stateChanged.

/**
	 * Upon state change, pop-up a tiny window with low-high.
	 *
	 * @param e ChangeEvent Object.
	 */
public void stateChanged(ChangeEvent e) {
    NumberRangeModel model = (NumberRangeModel) getModel();
    Number low = (Number) model.getLowValue();
    Number high = (Number) model.getHighValue();
    Number min = (Number) model.getMinValue();
    Number max = (Number) model.getMaxValue();
    DecimalFormat format;
    String lowStr = null;
    String highStr = null;
    if (low instanceof Integer) {
        lowStr = Integer.toString((Integer) low);
        highStr = Integer.toString((Integer) high);
    } else {
        if ((max.doubleValue() - min.doubleValue()) < .001) {
            format = new DecimalFormat("0.###E0");
        } else if ((max.doubleValue() - min.doubleValue()) > 100000) {
            format = new DecimalFormat("0.###E0");
        } else {
            format = new DecimalFormat("###,###.000");
        }
        lowStr = format.format(low);
        highStr = format.format(high);
    }
    if (isVisible()) {
        if (popup == null) {
            PopupFactory popupFactory = PopupFactory.getSharedInstance();
            JPanel panel = new JPanel();
            panel.setBorder(new LineBorder(Color.LIGHT_GRAY, 1));
            panel.setPreferredSize(getPreferredSize());
            panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
            popupLow = new JLabel(lowStr);
            popupLow.setBorder(new EmptyBorder(6, 2, 6, 2));
            popupHigh = new JLabel(highStr);
            popupHigh.setBorder(new EmptyBorder(6, 2, 6, 2));
            panel.add(popupLow);
            panel.add(Box.createHorizontalGlue());
            panel.add(popupHigh);
            popup = popupFactory.getPopup(this, panel, getLocationOnScreen().x, getLocationOnScreen().y + getPreferredSize().height + 2);
            popupDaemon = new PopupDaemon(this, 1000);
            popup.show();
        } else {
            popupLow.setText(lowStr);
            popupHigh.setText(highStr);
            popupDaemon.restart();
        }
    }
}
Also used : DecimalFormat(java.text.DecimalFormat) LineBorder(javax.swing.border.LineBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 15 with LineBorder

use of javax.swing.border.LineBorder in project adempiere by adempiere.

the class ContrastTheme method addCustomEntriesToTable.

public void addCustomEntriesToTable(UIDefaults table) {
    Border blackLineBorder = new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder = new BorderUIResource(new LineBorder(getWhite()));
    //
    Object textBorder = new BorderUIResource(new CompoundBorder(blackLineBorder, new BasicBorders.MarginBorder()));
    //	Enhancements
    Object[] defaults = new Object[] { "ToolTip.border", blackLineBorder, "TitledBorder.border", blackLineBorder, "TextField.border", textBorder, "PasswordField.border", textBorder, "TextArea.border", textBorder, "TextPane.border", textBorder, "EditorPane.border", textBorder, //
    "ComboBox.background", getWindowBackground(), "ComboBox.foreground", getUserTextColor(), "ComboBox.selectionBackground", getTextHighlightColor(), "ComboBox.selectionForeground", getHighlightedTextColor(), "ProgressBar.foreground", getUserTextColor(), "ProgressBar.background", getWindowBackground(), "ProgressBar.selectionForeground", getWindowBackground(), "ProgressBar.selectionBackground", getUserTextColor(), "OptionPane.errorDialog.border.background", getPrimary1(), "OptionPane.errorDialog.titlePane.foreground", getPrimary3(), "OptionPane.errorDialog.titlePane.background", getPrimary1(), "OptionPane.errorDialog.titlePane.shadow", getPrimary2(), "OptionPane.questionDialog.border.background", getPrimary1(), "OptionPane.questionDialog.titlePane.foreground", getPrimary3(), "OptionPane.questionDialog.titlePane.background", getPrimary1(), "OptionPane.questionDialog.titlePane.shadow", getPrimary2(), "OptionPane.warningDialog.border.background", getPrimary1(), "OptionPane.warningDialog.titlePane.foreground", getPrimary3(), "OptionPane.warningDialog.titlePane.background", getPrimary1(), "OptionPane.warningDialog.titlePane.shadow", getPrimary2() };
    table.putDefaults(defaults);
}
Also used : BorderUIResource(javax.swing.plaf.BorderUIResource) LineBorder(javax.swing.border.LineBorder) CompoundBorder(javax.swing.border.CompoundBorder) CompoundBorder(javax.swing.border.CompoundBorder) LineBorder(javax.swing.border.LineBorder) Border(javax.swing.border.Border)

Aggregations

LineBorder (javax.swing.border.LineBorder)37 ActionEvent (java.awt.event.ActionEvent)9 CompoundBorder (javax.swing.border.CompoundBorder)9 Color (java.awt.Color)7 Border (javax.swing.border.Border)7 ActionListener (java.awt.event.ActionListener)6 JButton (javax.swing.JButton)6 EmptyBorder (javax.swing.border.EmptyBorder)6 Dimension (java.awt.Dimension)4 JLabel (javax.swing.JLabel)4 JScrollPane (javax.swing.JScrollPane)4 BorderLayout (java.awt.BorderLayout)3 Font (java.awt.Font)3 JTextField (javax.swing.JTextField)3 Tree (com.intellij.ui.treeStructure.Tree)2 Point (java.awt.Point)2 ItemEvent (java.awt.event.ItemEvent)2 ItemListener (java.awt.event.ItemListener)2 MouseEvent (java.awt.event.MouseEvent)2 IOException (java.io.IOException)2