本文整理汇总了Java中javax.swing.JComponent.setBorder方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.setBorder方法的具体用法?Java JComponent.setBorder怎么用?Java JComponent.setBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.setBorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StartPageContent
import javax.swing.JComponent; //导入方法依赖的package包/类
public StartPageContent() {
super( new GridBagLayout() );
JComponent tabs = new TabbedPane( new LearnAndDiscoverTab(),
new MyNetBeansTab(),
new WhatsNewTab());
tabs.setBorder(BorderFactory.createEmptyBorder(10,15,15,15));
tabs.setOpaque(false);
add( tabs, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(27,0,0,0), 0, 0) );
add( new JLabel(), new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0) );
}
示例2: addInsetsToPanel
import javax.swing.JComponent; //导入方法依赖的package包/类
private static void addInsetsToPanel(JComponent comp) {
LayoutStyle layoutStyle = LayoutStyle.getInstance();
comp.setBorder(BorderFactory.createEmptyBorder(
layoutStyle.getContainerGap(comp, NORTH, null),
layoutStyle.getContainerGap(comp, WEST, null),
layoutStyle.getContainerGap(comp, SOUTH, null),
layoutStyle.getContainerGap(comp, EAST, null)));
}
示例3: addBorder
import javax.swing.JComponent; //导入方法依赖的package包/类
/**
* Adds a given border to a given component.
* If the component already has some border, the given border is put
* around the existing border.
*
* @param component component the border should be added to
* @param border the border to be added
*/
private static void addBorder(JComponent component,
Border newBorder) {
Border currentBorder = component.getBorder();
if (currentBorder == null) {
component.setBorder(newBorder);
} else {
component.setBorder(BorderFactory.createCompoundBorder(
newBorder, //outside
currentBorder)); //inside
}
}
示例4: applyFocus
import javax.swing.JComponent; //导入方法依赖的package包/类
private void applyFocus(boolean hasFocus, JComponent c) {
if (hasFocus) {
c.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, table.getSelectionBackground()
.darker()));
} else {
if (c.getBorder() != null) {
c.setBorder(null);
}
}
}
示例5: addTitledBorder
import javax.swing.JComponent; //导入方法依赖的package包/类
/**
* Adds a border and a title around a given component.
* If the component already has some border, it is overridden (not kept).
*
* @param component component the border and title should be added to
* @param insets insets between the component and the titled border
* @param title text of the title
*/
private static void addTitledBorder(JComponent component,
Insets insets,
String title) {
Border insideBorder = BorderFactory.createEmptyBorder(
insets.top, insets.left, insets.bottom, insets.right);
Border outsideBorder = new TitledBorder(
BorderFactory.createEtchedBorder(), title);
component.setBorder(new CompoundBorder(outsideBorder, insideBorder));
}
示例6: verify
import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
public boolean verify(JComponent input) {
boolean isValid = isValid(input);
if (!isValid) {
input.setBorder(BorderFactory.createLineBorder(Color.red));
} else {
input.setBorder(BorderFactory.createLineBorder(Color.BLACK));
}
return isValid;
}
示例7: mouseEntered
import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
public void mouseEntered(MouseEvent e) {
JComponent now = (JComponent) e.getSource();
if (now.getBorder() != Border.thumbPrevSelected) {
now.setBorder(thumbPrevOnFocus);
}
}
示例8: init
import javax.swing.JComponent; //导入方法依赖的package包/类
private void init(Runnable run) {
this.run = run;
JComponent c = ProgressHandleFactory.createProgressComponent(progressHandle);
c.setPreferredSize(new Dimension(3 * c.getPreferredSize().width, 3 * c.getPreferredSize().height));
c.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
getContentPane().add(c);
progressHandle.start();
getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(JavaHelp.class, "ACSD_Loading_Dialog")); //NOI18N
pack();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
Dimension me = getSize();
setLocation((screen.width - me.width) / 2, (screen.height - me.height) / 2);
}
示例9: getTableCellEditorComponent
import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
Component c = super.getTableCellEditorComponent(table, value, isSelected, row, column);
if (c instanceof JComponent && !(c instanceof JCheckBox)) {
JComponent component = (JComponent) c;
if (isSelected) {
component.setBorder(FocusedComponentBorder.getInstance());
} else {
component.setBorder(null);
}
}
return c;
}
示例10: getComponent
import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
public JPanel getComponent()
{
JPanel temp = new JPanel(new BorderLayout());
JTabbedPane p = new JTabbedPane();
for( BaseEntityTab<ItemDefinition> t : extra )
{
JComponent comp = t.getComponent();
comp.setBorder(AppletGuiUtils.DEFAULT_BORDER);
p.add(comp, t.getTitle());
}
temp.add(p);
return temp;
}
示例11: decorateJComponent
import javax.swing.JComponent; //导入方法依赖的package包/类
private void decorateJComponent(JComponent component) {
String prop = (String)component.getClientProperty("com.rapidminer.ui.label.type");
if("header".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_28);
component.setForeground(SwingTools.RAPIDMINER_ORANGE);
} else if("bold".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_14);
component.setForeground(Color.DARK_GRAY);
} else if("normal".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_14);
component.setForeground(Color.DARK_GRAY);
} else if("large".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_16);
component.setForeground(Color.DARK_GRAY);
}
prop = (String)component.getClientProperty("com.rapidminer.ui.button.type");
if("cfa".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_14);
component.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15));
} else if("normal".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_14);
component.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
component.setMinimumSize(new Dimension(175, component.getPreferredSize().height));
component.setPreferredSize(new Dimension(175, component.getPreferredSize().height));
}
prop = (String)component.getClientProperty("com.rapidmniner.ui.link_button.id");
if(prop != null && component instanceof LinkButton) {
((LinkButton)component).setText(this.generateHTML(prop));
}
Color foregroundColor = (Color)component.getClientProperty("com.rapidminer.ui.label.foreground");
if(foregroundColor != null) {
component.setForeground(foregroundColor);
}
}
示例12: wrapPanel
import javax.swing.JComponent; //导入方法依赖的package包/类
private static JComponent wrapPanel(JComponent component) {
component.setBorder(new EmptyBorder(12, 12, 12, 12));
return component;
}
示例13: setEmpty
import javax.swing.JComponent; //导入方法依赖的package包/类
protected void setEmpty(JComponent comp) {
comp.setBorder(errorBorder);
comp.setToolTipText(empty);
}
示例14: setEtchedTitledBorder
import javax.swing.JComponent; //导入方法依赖的package包/类
public static void setEtchedTitledBorder(JComponent comp, String title) {
comp.setBorder(new TitledBorder(getEtchedBorder(), title));
}
示例15: HierarchyTopComponent
import javax.swing.JComponent; //导入方法依赖的package包/类
@NbBundle.Messages({
"TXT_NonActiveContent=<No View Available - Refresh Manually>",
"TXT_InspectHierarchyHistory=<empty>",
"TOOLTIP_RefreshContent=Refresh for entity under cursor",
"TOOLTIP_OpenJDoc=Open Javadoc Window",
"TOOLTIP_ViewHierarchyType=Hierachy View Type",
"TOOLTIP_InspectHierarchyHistory=Inspect Hierarchy History"
})
public HierarchyTopComponent() {
history = HistorySupport.getInstnace(this.getClass());
jdocFinder = SelectJavadocTask.create(this);
jdocTask = RP.create(jdocFinder);
explorerManager = new ExplorerManager();
rootChildren = new RootChildren();
filters = new HierarchyFilters();
explorerManager.setRootContext(Nodes.rootNode(rootChildren, filters));
selectedNodes = new InstanceContent();
lookup = new AbstractLookup(selectedNodes);
explorerManager.addPropertyChangeListener(this);
initComponents();
setName(Bundle.CTL_HierarchyTopComponent());
setToolTipText(Bundle.HINT_HierarchyTopComponent());
viewTypeCombo = new JComboBox(new DefaultComboBoxModel(ViewType.values()));
viewTypeCombo.setMinimumSize(new Dimension(MIN_TYPE_WIDTH,COMBO_HEIGHT));
viewTypeCombo.addActionListener(this);
viewTypeCombo.setToolTipText(Bundle.TOOLTIP_ViewHierarchyType());
historyCombo = new JComboBox(HistorySupport.createModel(history, Bundle.TXT_InspectHierarchyHistory()));
historyCombo.setMinimumSize(new Dimension(MIN_HISTORY_WIDTH,COMBO_HEIGHT));
historyCombo.setRenderer(HistorySupport.createRenderer(history));
historyCombo.addActionListener(this);
historyCombo.setEnabled(false);
historyCombo.getModel().addListDataListener(this);
historyCombo.setToolTipText(Bundle.TOOLTIP_InspectHierarchyHistory());
refreshButton = new JButton(ImageUtilities.loadImageIcon(REFRESH_ICON, true));
refreshButton.addActionListener(this);
refreshButton.setToolTipText(Bundle.TOOLTIP_RefreshContent());
jdocButton = new JButton(ImageUtilities.loadImageIcon(JDOC_ICON, true));
jdocButton.addActionListener(this);
jdocButton.setToolTipText(Bundle.TOOLTIP_OpenJDoc());
final Box upperToolBar = new MainToolBar(
constrainedComponent(viewTypeCombo, GridBagConstraints.HORIZONTAL, 1.0, new Insets(0,0,0,0)),
constrainedComponent(historyCombo, GridBagConstraints.HORIZONTAL, 1.5, new Insets(0,3,0,0)),
constrainedComponent(refreshButton, GridBagConstraints.NONE, 0.0, new Insets(0,3,0,0)),
constrainedComponent(jdocButton, GridBagConstraints.NONE, 0.0, new Insets(0,3,0,3)));
add(decorateAsUpperPanel(upperToolBar), BorderLayout.NORTH);
contentView = new JPanel();
contentView.setLayout(new CardLayout());
JPanel nonActiveContent = Utils.updateBackground(new JPanel());
nonActiveContent.setLayout(new BorderLayout());
nonActiveInfo = new JLabel(Bundle.TXT_NonActiveContent());
nonActiveInfo.setEnabled(false);
nonActiveInfo.setHorizontalAlignment(SwingConstants.CENTER);
nonActiveContent.add(nonActiveInfo, BorderLayout.CENTER);
btw = createBeanTreeView();
contentView.add(nonActiveContent, NON_ACTIVE_CONTENT);
contentView.add(btw, ACTIVE_CONTENT);
add(contentView,BorderLayout.CENTER);
lowerToolBar = new TapPanel();
lowerToolBar.setOrientation(TapPanel.DOWN);
final JComponent lowerButtons = filters.getComponent();
lowerButtons.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0));
lowerToolBar.add(lowerButtons);
final boolean expanded = NbPreferences.forModule(HierarchyTopComponent.class).
getBoolean(PROP_LOWER_TOOLBAR_EXPANDED, true); //NOI18N
lowerToolBar.setExpanded(expanded);
lowerToolBar.addPropertyChangeListener(this);
add(Utils.updateBackground(lowerToolBar), BorderLayout.SOUTH);
}