本文整理汇总了Java中javax.swing.border.CompoundBorder类的典型用法代码示例。如果您正苦于以下问题:Java CompoundBorder类的具体用法?Java CompoundBorder怎么用?Java CompoundBorder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompoundBorder类属于javax.swing.border包,在下文中一共展示了CompoundBorder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
/** Constructs rest of dialog.
*/
private void draw () {
list = new JList(listModel);
list.setBorder(new EmptyBorder(2, 2, 2, 2));
list.addListSelectionListener (new ListSelectionListener () {
@Override
public void valueChanged (ListSelectionEvent evt) {
updateSaveButton ();
}
}
);
// bugfix 37941, select first item in list
if (!listModel.isEmpty ()) {
list.setSelectedIndex (0);
} else {
updateSaveButton ();
}
JScrollPane scroll = new JScrollPane (list);
scroll.setBorder (new CompoundBorder (new EmptyBorder (12, 12, 11, 0), scroll.getBorder ()));
add(scroll, BorderLayout.CENTER);
list.setCellRenderer(new ExitDlgListCellRenderer());
list.getAccessibleContext().setAccessibleName((NbBundle.getBundle(ExitDialog.class)).getString("ACSN_ListOfChangedFiles"));
list.getAccessibleContext().setAccessibleDescription((NbBundle.getBundle(ExitDialog.class)).getString("ACSD_ListOfChangedFiles"));
this.getAccessibleContext().setAccessibleDescription((NbBundle.getBundle(ExitDialog.class)).getString("ACSD_ExitDialog"));
}
示例2: addZone
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
/**
* Adds a new zone in the StatusBar
*
* @param id
* @param zone
* @param constraints one of the constraint support by the
* {@link com.l2fprod.common.swing.PercentLayout}
*/
public void addZone(String id, Component zone, String constraints) {
// is there already a zone with this id?
Component previousZone = getZone(id);
if (previousZone != null) {
remove(previousZone);
idToZones.remove(id);
}
if (zone instanceof JComponent) {
JComponent jc = (JComponent) zone;
if (jc.getBorder() == null || jc.getBorder() instanceof UIResource) {
if (jc instanceof JLabel) {
jc.setBorder(
new CompoundBorder(zoneBorder, new EmptyBorder(0, 2, 0, 2)));
// ((JLabel) jc).setText(" ");
} else {
jc.setBorder(zoneBorder);
}
}
}
add(zone, constraints);
idToZones.put(id, zone);
}
示例3: create
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
@Override
public JDialog create(Consumer<JPanel> consumer) {
try {
window.setIconImage(new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/VISNode_64.png"))).getImage());
} catch (IOException ex) {
ExceptionHandler.get().handle(ex);
}
JPanel container = new JPanel(new BorderLayout());
container.setBorder(new CompoundBorder(new EmptyBorder(3, 3, 3, 3), new CompoundBorder(BorderFactory.createEtchedBorder(), new EmptyBorder(6, 6, 6, 6))));
consumer.accept(container);
window.getContentPane().setLayout(new BorderLayout());
window.getContentPane().add(container);
window.pack();
window.setLocationRelativeTo(null);
return window;
}
示例4: TransparentSectionButton
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
public TransparentSectionButton(ActionListener al) {
// force initialization of PropSheet look'n'feel values
UIManager.get( "nb.propertysheet" );
setMargin(new Insets(0, 3, 0, 3));
setFocusPainted( false );
setHorizontalAlignment( SwingConstants.LEFT );
setHorizontalTextPosition( SwingConstants.RIGHT );
setVerticalTextPosition( SwingConstants.CENTER );
updateProperties();
if( getBorder() instanceof CompoundBorder ) { // from BasicLookAndFeel
Dimension pref = getPreferredSize();
pref.height -= 3;
setPreferredSize( pref );
}
if(al != null) {
addActionListener(al);
}
initActions();
}
示例5: showProblem
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
private void showProblem(Problem problem) {
if(dialog == null) {
return;
}
if (problem == null) {
label.setText(" "); // NOI18N
innerPanel.setBorder(null);
next.setEnabled(!isPreviewRequired());
previewButton.setEnabled(true);
return;
}
innerPanel.setBorder(new CompoundBorder(new javax.swing.border.LineBorder(java.awt.Color.gray),
new EmptyBorder(0, 2, 2, 2)));
progressPanel.setVisible(true);
if (problem.isFatal()) {
displayError(problem.getMessage());
} else {
displayWarning(problem.getMessage());
}
dialog.pack();
}
示例6: adjustToolbarComponentSize
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
private void adjustToolbarComponentSize(JComponent button) {
if (adjusted.contains(button)) return;
// as we cannot get the button small enough using the margin and border...
if (button.getBorder() instanceof CompoundBorder) { // from BasicLookAndFeel
Dimension pref = button.getPreferredSize();
// XXX #41827 workaround w2k, that adds eclipsis (...) instead of actual text
if ("Windows".equals(UIManager.getLookAndFeel().getID())) { // NOI18N
pref.width += 9;
}
button.setPreferredSize(pref);
}
adjusted.add(button);
}
示例7: fromField
import javax.swing.border.CompoundBorder; //导入依赖的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;
}
示例8: initComponents2
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
private void initComponents2() {
header = new HeaderPanel();
title = header.getTitle();
button = header.getButton();
button2 = header.getButton2();
Border outsideBorder = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray);
Border insideBorder = BorderFactory.createEmptyBorder(3, 3, 3, 3);
CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(outsideBorder, insideBorder);
header.setBorder(compoundBorder);
button.setVisible(false);
button2.setVisible(false);
rightCornerHeader = new JPanel();
rightCornerHeader.setBorder(compoundBorder);
Color headerBgColor = UnitTable.getDarkerColor(getBackground());
header.setBackground(headerBgColor);
if (button != null) {
button.setOpaque(false);
}
if (button2 != null) {
button2.setOpaque(false);
}
rightCornerHeader.setBackground(headerBgColor);
setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 0));
}
示例9: setSelected
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
void setSelected () {
if (isMac) {
setBorder(new CompoundBorder (
new VariableBorder(null, selectedB, null, selectedB),
BorderFactory.createEmptyBorder(5, 5, 3, 5)
));
} else {
setBorder (new CompoundBorder (
new CompoundBorder (
new LineBorder (getTabPanelBackground()),
new LineBorder (selectedB)
),
new EmptyBorder (0, 2, 0, 2)
));
}
setBackground (selected);
}
示例10: setHighlighted
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
void setHighlighted() {
if (!isMac) {
setBorder(new CompoundBorder(
new CompoundBorder(
new LineBorder(getTabPanelBackground()),
new LineBorder(highlightedB)
),
new EmptyBorder(0, 2, 0, 2)
));
setBackground(highlighted);
}
if (!category.isHighlited()) {
if (categoryModel.getHighlitedCategoryID() != null) {
CategoryButton b = buttons.get(categoryModel.getHighlitedCategoryID());
if (b != null && !b.category.isCurrent()) {
b.setNormal();
}
}
categoryModel.setHighlited(category,true);
}
}
示例11: adjustToolbarComponentSize
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
private void adjustToolbarComponentSize(JComponent button) {
if (adjusted.contains(button)) return;
// as we cannot get the button small enough using the margin and border...
if (button.getBorder() instanceof CompoundBorder) { // from BasicLookAndFeel
Dimension pref = button.getPreferredSize();
// XXX #41827 workaround w2k, that adds eclipsis (...) instead of actual text
if ("Windows".equals(UIManager.getLookAndFeel().getID())) { // NOI18N
pref.width += 9;
}
button.setPreferredSize(pref);
}
adjusted.add(button);
}
示例12: handleSummary
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
void handleSummary(Summary summary)
{
inSummary = true;
JComponent summaryComp = (JComponent) summary.getSummaryComponent(); // XXX
if (summaryComp.getBorder() != null)
{
CompoundBorder b = new CompoundBorder(new EmptyBorder(5, 5, 5, 5), summaryComp
.getBorder());
summaryComp.setBorder(b);
}
setCurrentWizardPanel(summaryComp); // XXX
instructions.setInSummaryPage(true);
ttlLabel.setText(NbBridge.getString("org/netbeans/api/wizard/Bundle", // NOI18N
WizardDisplayerImpl.class, "Summary")); // NOI18N
getButtonManager().setSummaryShowingMode();
summaryComp.requestFocus();
}
示例13: createTitlePanel
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
private JPanel createTitlePanel() {
JPanel title = new JPanel(new BorderLayout());
title.add(Guitilities.createGradientTitle(getTranslation("components.title")), BorderLayout.NORTH);
JPanel interact = new JPanel();
interact.setBackground(UIManager.getColor(Guitilities.SUB_PANEL_BACKGROUND));
interact.setLayout(new BoxLayout(interact, BoxLayout.X_AXIS));
interact.setBorder(new CompoundBorder(Guitilities.CHISEL_BORDER, new EmptyBorder(12, 8, 12, 8)));
final JCheckBox checkImages = new JCheckBox(getTranslation("group.images"), true);
checkImages.setBackground(UIManager.getColor(Guitilities.SUB_PANEL_BACKGROUND));
checkImages.addActionListener(new ActionListener() {
@Override public void actionPerformed(ActionEvent event) {
for(ComponentButton button:componentButtons)
button.setIconVisible(checkImages.isSelected());
for(CollapsiblePanel panel:collapsiblePanels)
panel.setExpanded(false);
}
});
interact.add(checkImages);
title.add(interact, BorderLayout.CENTER);
return title;
}
示例14: addCustomEntriesToTable
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
@Override
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()));
table.put("ToolTip.border", blackLineBorder);
table.put("TitledBorder.border", blackLineBorder);
table.put("Table.focusCellHighlightBorder", whiteLineBorder);
table.put("Table.focusCellForeground", getWhite());
table.put("TextField.border", textBorder);
table.put("PasswordField.border", textBorder);
table.put("TextArea.border", textBorder);
table.put("TextPane.font", textBorder);
}
示例15: WaveChart
import javax.swing.border.CompoundBorder; //导入依赖的package包/类
public WaveChart(String chartContent,String title,String yaxisName)
{
super();
this.chart=createChart(chartContent,title,yaxisName);
addChart(this.chart);
// 将JFreeChart放在专用的图表容器ChartPanel中
this.chartPanel = new ChartPanel(this.chart);
this.chartPanel.setPreferredSize(new Dimension(500, 350));
// 设置chartPanel容器边框
CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(
BorderFactory.createEmptyBorder(1, 1,1, 1),
BorderFactory.createEtchedBorder());
this.chartPanel.setBorder(compoundBorder);
// 将chartPanel加入到本容器中
add(this.chartPanel);
}