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);
}
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;
}
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;
}
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();
}
}
}
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);
}
Aggregations