use of javax.swing.border.LineBorder in project JMRI by JMRI.
the class PositionablePropertiesUtil method preview.
void preview() {
int attrs = Font.PLAIN;
if (bold.isSelected()) {
attrs = Font.BOLD;
}
if (italic.isSelected()) {
attrs |= Font.ITALIC;
}
Font newFont = new Font(_parent.getFont().getName(), attrs, Integer.parseInt(fontSizeField.getText()));
Color desiredColor;
desiredColor = colorFromComboBox(borderColorCombo, null);
Border borderMargin = BorderFactory.createEmptyBorder(0, 0, 0, 0);
int margin = ((Number) marginSizeTextSpin.getValue()).intValue();
Border outlineBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
if (desiredColor != null) {
outlineBorder = new LineBorder(desiredColor, ((Number) borderSizeTextSpin.getValue()).intValue());
} else {
outlineBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
}
int hoz = 0;
switch(_justificationCombo.getSelectedIndex()) {
case 0:
hoz = (0x02);
break;
case 1:
hoz = (0x04);
break;
case 2:
hoz = (0x00);
break;
default:
log.warn("Unhandled combo index: {}", _justificationCombo.getSelectedIndex());
break;
}
for (int i = 0; i < txtList.size(); i++) {
JLabel tmp = txtList.get(i).getLabel();
if (tmp.isOpaque()) {
borderMargin = new LineBorder(tmp.getBackground(), margin);
} else {
borderMargin = BorderFactory.createEmptyBorder(margin, margin, margin, margin);
}
tmp.setFont(newFont);
tmp.setHorizontalAlignment(hoz);
tmp.setBorder(new CompoundBorder(outlineBorder, borderMargin));
tmp.setSize(new Dimension(maxWidth(tmp), maxHeight(tmp)));
tmp.setPreferredSize(new Dimension(maxWidth(tmp), maxHeight(tmp)));
}
mFrame.pack();
}
use of javax.swing.border.LineBorder in project JMRI by JMRI.
the class DecoratorPanel method updateSamples.
private void updateSamples() {
if (_previewPanel == null) {
return;
}
int mar = _util.getMargin();
int bor = _util.getBorderSize();
Border outlineBorder;
if (bor == 0) {
outlineBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
} else {
outlineBorder = new LineBorder(_util.getBorderColor(), bor);
}
Font font = _util.getFont();
int just = _util.getJustification();
Iterator<PositionableLabel> it = _sample.values().iterator();
while (it.hasNext()) {
PositionableLabel sam = it.next();
PositionablePopupUtil util = sam.getPopupUtility();
sam.setFont(font);
util.setFixedWidth(_util.getFixedWidth());
util.setFixedHeight(_util.getFixedHeight());
util.setMargin(mar);
util.setBorderSize(bor);
Border borderMargin;
if (sam.isOpaque()) {
borderMargin = new LineBorder(sam.getBackground(), mar);
} else {
borderMargin = BorderFactory.createEmptyBorder(mar, mar, mar, mar);
}
sam.setBorder(new CompoundBorder(outlineBorder, borderMargin));
switch(just) {
case PositionablePopupUtil.LEFT:
sam.setHorizontalAlignment(JLabel.LEFT);
break;
case PositionablePopupUtil.RIGHT:
sam.setHorizontalAlignment(JLabel.RIGHT);
break;
default:
sam.setHorizontalAlignment(JLabel.CENTER);
}
sam.updateSize();
sam.setPreferredSize(sam.getSize());
sam.repaint();
}
if (_dialog != null) {
_dialog.pack();
}
}
use of javax.swing.border.LineBorder in project beast-mcmc by beast-dev.
the class JTableButtonCellRenderer method getTableCellRendererComponent.
// END: Constructor
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JButton button = (JButton) value;
if (isSelected) {
button.setForeground(table.getSelectionForeground());
button.setBackground(table.getSelectionBackground());
} else {
button.setForeground(table.getForeground());
button.setBackground(UIManager.getColor("Button.background"));
}
if (hasFocus) {
button.setBorder(new LineBorder(Color.BLUE));
} else {
button.setBorder(button.getBorder());
}
// label on button
if (dataList != null) {
// switch between edit taxa and choose file labels
String label = null;
switch(columnIndex) {
case TreesTableModel.TREE_FILE_INDEX:
if (!dataList.recordsList.get(row).isTreeSet()) {
label = Utils.CHOOSE_FILE;
} else {
label = dataList.recordsList.get(row).getName();
}
break;
case TreesTableModel.TAXA_SET_INDEX:
if (!dataList.recordsList.get(row).isTaxaSet()) {
label = Utils.EDIT_TAXA_SET;
} else {
label = dataList.recordsList.get(row).getName();
}
break;
default:
break;
}
// END: switch
button.setText(label);
}
// tooltips
if (toolTipText != null) {
button.setToolTipText(toolTipText);
}
return button;
}
use of javax.swing.border.LineBorder in project jgnash by ccavanaugh.
the class NewFileSummary method layoutMainPanel.
private void layoutMainPanel() {
initComponents();
FormLayout layout = new FormLayout("p, 8dlu, d:g", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout, this);
builder.appendSeparator(rb.getString("Title.Summary"));
builder.append(rb.getString("Label.FileName"), fileField);
builder.append(rb.getString("Label.DefaultCurrency"), baseCurrencyField);
JScrollPane scrollPane = new JScrollPane(currenciesList);
scrollPane.setBorder(new LineBorder((Color) UIManager.getDefaults().get("TextArea.inactiveForeground")));
builder.append(rb.getString("Label.Currencies"), scrollPane);
}
use of javax.swing.border.LineBorder in project gephi by gephi.
the class BasicRichTooltipPanelUI method installDefaults.
/**
* Installs default settings for the associated rich tooltip panel.
*/
protected void installDefaults() {
Border b = this.richTooltipPanel.getBorder();
if (b == null || b instanceof UIResource) {
Border toSet = UIManager.getBorder("RichTooltipPanel.border");
if (toSet == null)
toSet = new BorderUIResource.CompoundBorderUIResource(new LineBorder(FlamingoUtilities.getBorderColor()), new EmptyBorder(2, 4, 3, 4));
this.richTooltipPanel.setBorder(toSet);
}
LookAndFeel.installProperty(this.richTooltipPanel, "opaque", Boolean.TRUE);
}
Aggregations