本文整理匯總了Java中javax.swing.border.MatteBorder類的典型用法代碼示例。如果您正苦於以下問題:Java MatteBorder類的具體用法?Java MatteBorder怎麽用?Java MatteBorder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MatteBorder類屬於javax.swing.border包,在下文中一共展示了MatteBorder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fromField
import javax.swing.border.MatteBorder; //導入依賴的package包/類
static BorderBuilder fromField(Instance instance, String field, boolean uiresource, Heap heap) {
Object _border = instance.getValueOfField(field);
if (!(_border instanceof Instance)) return null;
Instance border = (Instance)_border;
// Make sure subclasses are listed before base class if using isSubclassOf
if (DetailsUtils.isSubclassOf(border, BevelBorder.class.getName())) {
return new BevelBorderBuilder(border, heap);
} else if (DetailsUtils.isSubclassOf(border, MatteBorder.class.getName())) { // Must be before EmptyBorder (extends EmptyBorder)
return new EmptyBorderBuilder(border, heap);
} else if (DetailsUtils.isSubclassOf(border, EmptyBorder.class.getName())) {
return new MatteBorderBuilder(border, heap);
} else if (DetailsUtils.isSubclassOf(border, EtchedBorder.class.getName())) {
return new EtchedBorderBuilder(border, heap);
} else if (DetailsUtils.isSubclassOf(border, LineBorder.class.getName())) {
return new LineBorderBuilder(border, heap);
} else if (DetailsUtils.isSubclassOf(border, TitledBorder.class.getName())) {
return new TitledBorderBuilder(border, heap);
} else if (DetailsUtils.isSubclassOf(border, CompoundBorder.class.getName())) {
return new CompoundBorderBuilder(border, heap);
}
return null;
}
示例2: instantiate
import javax.swing.border.MatteBorder; //導入依賴的package包/類
protected Expression instantiate(Object oldInstance, Encoder out) {
MatteBorder border = (MatteBorder) oldInstance;
Insets insets = border.getBorderInsets();
Object object = border.getTileIcon();
if (object == null) {
object = border.getMatteColor();
}
Object[] args = new Object[] {
insets.top,
insets.left,
insets.bottom,
insets.right,
object,
};
return new Expression(border, border.getClass(), "new", args);
}
示例3: testMatteBorder
import javax.swing.border.MatteBorder; //導入依賴的package包/類
public void testMatteBorder() {
DumperOptions options = new DumperOptions();
options.setWidth(400);
Yaml yaml = new Yaml(new ImmutablesRepresenter(), options);
Insets insets = new Insets(10, 20, 30, 40);
Color color = new Color(100, 150, 200);
MatteBorder border = BorderFactory.createMatteBorder(insets.top, insets.left,
insets.bottom, insets.right, color);
String dump = yaml.dump(border);
assertEquals(
"!!javax.swing.border.MatteBorder [!!java.awt.Insets [10, 20, 30, 40], !!java.awt.Color [100, 150, 200, 255]]\n",
dump);
Object loaded = yaml.load(dump);
assertTrue(loaded instanceof MatteBorder);
MatteBorder loadedBorder = (MatteBorder) loaded;
assertEquals(insets, loadedBorder.getBorderInsets());
assertEquals(color, loadedBorder.getMatteColor());
}
示例4: addComponent
import javax.swing.border.MatteBorder; //導入依賴的package包/類
public void addComponent(JPanelMenu menu) {
// if (p.x > 20) {
// p.x = 20;
// p.y += 55;
// }
// p.y += 20; // 20 puntitos extra de separacion.
JLabel lbl = new JLabel(AppLocal.getIntString(KeyText));
lbl.applyComponentOrientation(menu.getComponentOrientation());
lbl.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), new Color(0, 0, 0)));
// lbl.setSize(670, 20);
// lbl.setLocation(p);
// p.y += 35;
// comp.add(lbl);
menu.addTitle(lbl);
}
示例5: updateDetailsBorder
import javax.swing.border.MatteBorder; //導入依賴的package包/類
private void updateDetailsBorder(@Nullable VcsFullCommitDetails data) {
if (data == null || !myColorManager.isMultipleRoots()) {
myMainContentPanel.setBorder(BorderFactory.createEmptyBorder());
}
else {
Color color = VcsLogGraphTable.getRootBackgroundColor(data.getRoot(), myColorManager);
myMainContentPanel.setBorder(new CompoundBorder(new MatteBorder(0, VcsLogGraphTable.ROOT_INDICATOR_COLORED_WIDTH, 0, 0, color),
new MatteBorder(0, VcsLogGraphTable.ROOT_INDICATOR_WHITE_WIDTH, 0, 0,
new JBColor(new NotNullProducer<Color>() {
@NotNull
@Override
public Color produce() {
return getDetailsBackground();
}
}))));
}
}
示例6: initStatusBar
import javax.swing.border.MatteBorder; //導入依賴的package包/類
private void initStatusBar() {
jlStatusBar = new JLabel();
int rightPadding = 3;
if (OperatingSystem.isMacOs()) {
rightPadding = 15; // Allow extra padding in the grow box status bar
// if using Mac OS
}
jlStatusBar.setBorder(new CompoundBorder(new MatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY), new EmptyBorder(3, 3,
3, rightPadding)));
setDefaultStatusBarText();
if (applicationSettings.getShowStatusBar()) {
frame.getContentPane().add(jlStatusBar, BorderLayout.SOUTH);
}
}
示例7: addComponent
import javax.swing.border.MatteBorder; //導入依賴的package包/類
/**
*
* @param menu
*/
@Override
public void addComponent(JPanelMenu menu) {
// if (p.x > 20) {
// p.x = 20;
// p.y += 55;
// }
// p.y += 20; // 20 puntitos extra de separacion.
JLabel lbl = new JLabel(AppLocal.getIntString(KeyText));
lbl.applyComponentOrientation(menu.getComponentOrientation());
lbl.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), new Color(0, 0, 0)));
// lbl.setSize(670, 20);
// lbl.setLocation(p);
// p.y += 35;
// comp.add(lbl);
// lbl.setFont(new Font("DotumChe",Font.PLAIN,14));
menu.addTitle(lbl);
}
示例8: addComponent
import javax.swing.border.MatteBorder; //導入依賴的package包/類
/**
*
* @param menu
*/
@Override
public void addComponent(JPanelMenu menu) {
// if (p.x > 20) {
// p.x = 20;
// p.y += 55;
// }
// p.y += 20; // 20 puntitos extra de separacion.
JLabel lbl = new JLabel(AppLocal.getIntString(KeyText));
lbl.applyComponentOrientation(menu.getComponentOrientation());
lbl.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), new Color(0, 0, 0)));
// lbl.setSize(670, 20);
// lbl.setLocation(p);
// p.y += 35;
// comp.add(lbl);
menu.addTitle(lbl);
}
示例9: makeBotOrMiddle
import javax.swing.border.MatteBorder; //導入依賴的package包/類
private static void makeBotOrMiddle(final int index, final int bottom) {
fileListingRows.get(index).setInGroup(true);
JTextField textField = new JTextField();
textField.setSize(200, 30);
textField.setEditable(false);
textField.setPreferredSize(new Dimension(200, 25));
textField.setBorder(new MatteBorder(0, 0, bottom, 0, borderColor));
new FileDrop(textField, textField.getBorder(), new FileDrop.Listener() {
@Override
public void filesDropped(final File[] files) {
for (int i = 0; i < files.length; i++) {
FileListing.addFile(files[i], fileListingRows.get(i)
.getXmlFormat().getSelectedItem().toString());
}
}
});
listing.add(textField, fileListingCons, (index * COLSINLISTING) + 2);
}
示例10: testBorder
import javax.swing.border.MatteBorder; //導入依賴的package包/類
@Test
public void testBorder() throws Exception {
final int top = 9;
final int left = 3;
final int bottom = 1;
final int right = 6;
final Color matteColor = new Color(174, 2, 126);
matteBorderDecorator.set(top, left, bottom, right, matteColor);
final MatteBorder matte = new MatteBorder(top, left, bottom, right, matteColor);
assertEquals(button.getBorder().getClass(), matte.getClass());
final MatteBorder border = (MatteBorder) button.getBorder();
assertEquals(border.getBorderInsets(), matte.getBorderInsets());
assertEquals(border.getMatteColor(), matte.getMatteColor());
}
示例11: getListCellRendererComponent
import javax.swing.border.MatteBorder; //導入依賴的package包/類
@Override
public Component getListCellRendererComponent(
JList<? extends TransactionBean> list,
TransactionBean value, int index, boolean isSelected,
boolean cellHasFocus)
{
JTextPane client = new JTextPane();
client.setEditable(false);
client.setContentType("text/html");
TransactionRenderOpsBean ops = mRuntime.getRenderOps();
String html = TransactionLogic.renderAsHTML(value, ops);
int w = list.getFixedCellWidth();
if (w < 0)
w = 750;
else
w = w*3/4;
html = "<html><body><table width=\""+w+"px\">"+html+"</table></body></html>";
client.setText(html);
if (cellHasFocus)
client.setBorder(new MatteBorder(1, 5, 1, 1, Color.DARK_GRAY));
client.setBackground(isSelected ? SELECTED : DESELECTED);
return client;
}
示例12: initComponentDefaults
import javax.swing.border.MatteBorder; //導入依賴的package包/類
@Override
protected void initComponentDefaults(UIDefaults table) {
super.initComponentDefaults(table);
Border lineBorder = new BorderUIResource(new MatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY));
Object textBorder = new BorderUIResource(new CompoundBorder(lineBorder, new BasicBorders.MarginBorder()));
Object[] defaults = new Object[] { "ComboBox.selectionForeground", getHighlightedTextColor(), "Panel.font", getControlTextFont(),
"ToolTip.border", lineBorder,
"TitledBorder.border", lineBorder,
"TextField.border", textBorder,
"PasswordField.border", textBorder,
"TextArea.border", textBorder,
"TextPane.border", textBorder,
"EditorPane.border", textBorder,
"Button.border", lineBorder,
};
table.putDefaults(defaults);
}
示例13: addButton
import javax.swing.border.MatteBorder; //導入依賴的package包/類
/**
* Adds a button to this {@link ComboButton}. Beware that this method does
* change the styling (colors, borders etc.) of the button to make it fit
* the {@link ComboButton}.
*
* @param button
*/
public void addButton(final AbstractButton button) {
WidgetUtils.setDefaultButtonStyle(button);
final EmptyBorder baseBorder =
new EmptyBorder(WidgetUtils.BORDER_WIDE_WIDTH - 1, 9, WidgetUtils.BORDER_WIDE_WIDTH - 1, 9);
if (getComponentCount() == 0) {
button.setBorder(baseBorder);
} else {
final Component lastComponent = getComponent(getComponentCount() - 1);
if (lastComponent instanceof AbstractButton) {
// previous component was also a button - add a line on the left
// side
final Border outsideBorder = new MatteBorder(0, 1, 0, 0, WidgetUtils.BG_COLOR_LESS_BRIGHT);
button.setBorder(new CompoundBorder(outsideBorder, baseBorder));
} else {
button.setBorder(baseBorder);
}
}
button.setOpaque(false);
_buttons.add(button);
add(button);
}
示例14: createSmallButton
import javax.swing.border.MatteBorder; //導入依賴的package包/類
public static JButton createSmallButton(final String text, final Icon icon) {
final JButton b = new JButton(icon);
if (text != null) {
b.setText(text);
b.setFont(WidgetUtils.FONT_SMALL);
}
b.setMargin(new Insets(0, 0, 0, 0));
b.setUI(new MetalButtonUI());
b.setBackground(WidgetUtils.COLOR_WELL_BACKGROUND);
final MatteBorder outerBorder = new MatteBorder(1, 1, 1, 1, WidgetUtils.BG_COLOR_LESS_BRIGHT);
b.setBorder(new CompoundBorder(outerBorder, new EmptyBorder(2, 4, 2, 4)));
b.setFocusPainted(false);
return b;
}
示例15: MaterialTabBarButton
import javax.swing.border.MatteBorder; //導入依賴的package包/類
public MaterialTabBarButton(SwingViewContainer2 viewContainer, MaterialStyle materialStyle, SwingView view, boolean selected) {
setContentAreaFilled(false);
setFocusable(false);
addMouseListener(createBackgroundPainter(viewContainer, ColorFactory.create(materialStyle.getTabToolbarStyle().getPressedColor()), view));
// setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, style.COLORS.getForeground1()));
// setBorder(BorderFactory.createBevelBorder(1));
// setText(view.getViewTitle().toUpperCase());
//putting everything in a label so we can use borders
JLabel label = new JLabel(view.getViewTitle().toUpperCase());
EmptyBorder padding = new EmptyBorder(12,12,12,12);
if (selected) {
MatteBorder bottomBar = BorderFactory.createMatteBorder(0, 0, 2, 0,ColorFactory.create( materialStyle.getTabContainerStyle().getBackground()));
label.setBorder(new CompoundBorder( bottomBar, padding));
} else {
label.setBorder(padding);
}
label.setFont(AwtFontFactory.create(materialStyle.getTabToolbarButtonStyle().getFont()));
label.setForeground(ColorFactory.create(materialStyle.getTabToolbarButtonStyle().getTextColor()));
add(label);
}