本文整理汇总了Java中javax.swing.BorderFactory.createCompoundBorder方法的典型用法代码示例。如果您正苦于以下问题:Java BorderFactory.createCompoundBorder方法的具体用法?Java BorderFactory.createCompoundBorder怎么用?Java BorderFactory.createCompoundBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.BorderFactory
的用法示例。
在下文中一共展示了BorderFactory.createCompoundBorder方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initComponents2
import javax.swing.BorderFactory; //导入方法依赖的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));
}
示例2: updateProblem
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void updateProblem()
{
String prob = wizard.getProblem();
problem.setText(prob == null ? " " : prob); // NOI18N
if (prob != null && prob.trim().length() == 0)
{
// Issue 3 - provide ability to disable next w/o
// showing the error line
prob = null;
}
Border b = prob == null ? BorderFactory.createEmptyBorder(1, 0, 0, 0) : BorderFactory
.createMatteBorder(1, 0, 0, 0, problem.getForeground());
Border b1 = BorderFactory.createCompoundBorder(BorderFactory
.createEmptyBorder(0, 12, 0, 12), b);
problem.setBorder(b1);
}
示例3: jbInit
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void jbInit() throws Exception {
border1 =
BorderFactory.createCompoundBorder(
BorderFactory.createEtchedBorder(
Color.white,
new Color(156, 156, 158)),
BorderFactory.createEmptyBorder(5, 5, 5, 5));
border2 = BorderFactory.createEmptyBorder(5, 0, 5, 0);
panel1.setLayout(borderLayout1);
this.getContentPane().setLayout(borderLayout2);
bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
topPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5)));
topPanel.setBackground(Color.WHITE);
jPanel1.setLayout(borderLayout3);
panel1.setBorder(border1);
jPanel1.setBorder(border2);
getContentPane().add(panel1, BorderLayout.CENTER);
panel1.add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(stickerText, null);
panel1.add(jPanel1, BorderLayout.SOUTH);
this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
this.getContentPane().add(topPanel, BorderLayout.NORTH);
stickerText.setText(txt);
stickerText.setOpaque(true);
stickerText.setBackground(backGroundColor);
stickerText.setForeground(foreGroundColor);
}
示例4: configure
import javax.swing.BorderFactory; //导入方法依赖的package包/类
public void configure( Color foreground, Color background, boolean isSelected, boolean hasFocus, int rowHeight, int rowWidth ) {
removeAll();
int maxWidth = rowWidth - SelectionList.INSETS_LEFT - SelectionList.INSETS_RIGHT;
JComponent inner = node.getComponent( foreground, background, isSelected, hasFocus, maxWidth > 0 ? maxWidth : 0);
add( inner, BorderLayout.CENTER );
setBackground( background );
setForeground( foreground );
Border border = null;
if( hasFocus ) {
if( isSelected ) {
border = UIManager.getBorder( "List.focusSelectedCellHighlightBorder" ); // NOI18N
}
if( border == null ) {
border = UIManager.getBorder( "List.focusCellHighlightBorder" ); // NOI18N
}
}
if( null != border ) {
border = BorderFactory.createCompoundBorder( border,
BorderFactory.createEmptyBorder( SelectionList.INSETS_TOP, SelectionList.INSETS_LEFT,
SelectionList.INSETS_BOTTOM, SelectionList.INSETS_RIGHT ) );
} else {
border = BorderFactory.createEmptyBorder( SelectionList.INSETS_TOP, SelectionList.INSETS_LEFT,
SelectionList.INSETS_BOTTOM, SelectionList.INSETS_RIGHT );
}
try {
setBorder( border );
} catch( NullPointerException npe ) {
//workaround for 175940
Logger.getLogger( ListRendererPanel.class.getName() ).log( Level.INFO, "Bug #175940", npe );
}
RendererPanel.configureAccessibility(this, false);
}
示例5: setProfilingPointFactory
import javax.swing.BorderFactory; //导入方法依赖的package包/类
public void setProfilingPointFactory(ProfilingPointFactory ppFactory, int index) {
this.ppFactory = ppFactory;
if (ppFactory != null) {
label.setText(ppFactory.getType());
label.setIcon(ppFactory.getIcon());
} else {
label.setText(NO_ACTION_NAME);
label.setIcon(NO_ACTION_ICON);
}
Component selected = null;
if ((index >= 0) && (index < previewPanel.getComponentCount())) {
selected = previewPanel.getComponent(index);
}
for (Component c : previewPanel.getComponents()) {
if (c == selected) {
Border empt1 = BorderFactory.createEmptyBorder(2, 2, 2, 2);
Border sel = BorderFactory.createMatteBorder(1, 1, 1, 1, SystemColor.textHighlight);
Border empt2 = BorderFactory.createEmptyBorder(0, 2, 0, 2);
Border comp1 = BorderFactory.createCompoundBorder(empt2, sel);
Border comp2 = BorderFactory.createCompoundBorder(comp1, empt1);
((JComponent) c).setBorder(comp2);
} else {
((JComponent) c).setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
}
}
}
示例6: setBorder
import javax.swing.BorderFactory; //导入方法依赖的package包/类
/** Overridden to combine the expansion border (whose insets determine how
* much a child tree node is shifted to the right relative to the ancestor
* root node) with whatever border is set, as a CompoundBorder. The expansion
* border is also responsible for drawing the expansion icon.
* @param b the border to be rendered for this component
*/
@Override
public final void setBorder (Border b) {
b = new RestrictedInsetsBorder(b);
if (!swingRendering) {
super.setBorder(b);
return ;
}
if (b == expansionBorder) {
super.setBorder(b);
} else {
super.setBorder(BorderFactory.createCompoundBorder (b, expansionBorder));
}
}
示例7: jbInit
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void jbInit() throws Exception {
this.setResizable(false);
this.setIconImage(new ImageIcon(EventNotificationDialog.class.getResource("resources/icons/jnotes16.png")).getImage());
this.getContentPane().setBackground(new Color(251, 197, 63));
border2 = BorderFactory.createEmptyBorder(0,30,0,30);
border3 = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(Color.white,new Color(142, 142, 142)),BorderFactory.createEmptyBorder(0,30,0,30));
border4 = BorderFactory.createEmptyBorder(10,10,0,10);
panel1.setLayout(borderLayout1);
panel1.setBackground(new Color(251, 197, 63));
jButton1.setText(Local.getString("Ok"));
jButton1.setBounds(150, 415, 95, 30);
jButton1.setPreferredSize(new Dimension(95, 30));
jButton1.setBackground(new Color(69, 125, 186));
jButton1.setForeground(Color.white);
jButton1.setDefaultCapable(true);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
panel1.setBorder(border4);
panel1.setMinimumSize(new Dimension(300, 200));
panel1.setPreferredSize(new Dimension(300, 200));
timeLabel.setFont(new java.awt.Font("Dialog", 0, 20));
timeLabel.setHorizontalAlignment(SwingConstants.CENTER);
textLabel.setHorizontalAlignment(SwingConstants.CENTER);
getContentPane().add(panel1);
panel1.add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(jButton1, null);
jPanel1.setBackground(new Color(251, 197, 63));
panel1.add(textLabel, BorderLayout.CENTER);
panel1.add(timeLabel, BorderLayout.NORTH);
playSoundNotification();
}
示例8: createInstanceImpl
import javax.swing.BorderFactory; //导入方法依赖的package包/类
protected Border createInstanceImpl() {
Border outside = outsideBorder == null || outsideBorder.isUIResource() ?
null : outsideBorder.createInstance();
Border inside = insideBorder == null || insideBorder.isUIResource() ?
null : insideBorder.createInstance();
if (outside == null && inside == null) {
return BorderFactory.createEmptyBorder();
} else if (outside == null || inside == null) {
if (outside == null) return inside;
else return outside;
} else {
return BorderFactory.createCompoundBorder(outside, inside);
}
}
示例9: jbInit
import javax.swing.BorderFactory; //导入方法依赖的package包/类
void jbInit() throws Exception {
this.setResizable(false);
this.setIconImage(new ImageIcon(PopupDesktopNotification.class.getResource("/ui/icons/jnotes16.png")).getImage());
this.getContentPane().setBackground(ColorMap.POPBG);
border2 = BorderFactory.createEmptyBorder(0,30,0,30);
border3 = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(Color.white,ColorMap.POPBG),BorderFactory.createEmptyBorder(0,30,0,30));
border4 = BorderFactory.createEmptyBorder(10,10,0,10);
panel1.setLayout(borderLayout1);
panel1.setBackground(ColorMap.POPBG);
jButton1.setText(Local.getString("Ok"));
jButton1.setBounds(150, 415, 95, 30);
jButton1.setPreferredSize(new Dimension(95, 30));
jButton1.setBackground(ColorMap.OKBNBG);
jButton1.setForeground(ColorMap.OKBNFG);
jButton1.setDefaultCapable(true);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
panel1.setBorder(border4);
panel1.setMinimumSize(new Dimension(300, 200));
panel1.setPreferredSize(new Dimension(300, 200));
timeLabel.setFont(new java.awt.Font("Dialog", 0, 20));
timeLabel.setHorizontalAlignment(SwingConstants.CENTER);
textLabel.setHorizontalAlignment(SwingConstants.CENTER);
getContentPane().add(panel1);
panel1.add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(jButton1, null);
jPanel1.setBackground(ColorMap.POPBG);
panel1.add(textLabel, BorderLayout.CENTER);
panel1.add(timeLabel, BorderLayout.NORTH);
playSoundNotification();
}
示例10: ViewAlkaneLengthSelection
import javax.swing.BorderFactory; //导入方法依赖的package包/类
public ViewAlkaneLengthSelection(String frameTitle){
super(frameTitle);
this.setMinimumSize(new Dimension(500,200));
alkaneSpherePanel = new JPanel();
this.add(alkaneSpherePanel);
closeWindow = new JButton("Cancel");
saveValues = new JButton("Save");
GridBagLayout gridbagOtherParam = new GridBagLayout();
alkaneSpherePanel.setLayout(gridbagOtherParam);
NoOfSpheres = new JTextField();
NoOfSpheres.setColumns(10);
NoOfSpheres.setSize(new Dimension(5,20));
NoOfSpheres.setText("4");
JLabel NLabel = new JLabel("Cn (where n is 4 or greater)");
NLabel.setLabelFor(NoOfSpheres);
Border compoundField1;
compoundField1 = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
NoOfSpheres.setBorder(compoundField1);
JComponent[] OtherParamLeft= {NLabel,saveValues};
JComponent[] OtherParamRight = { NoOfSpheres,closeWindow};
addLeftRightComponents(OtherParamLeft,OtherParamRight,gridbagOtherParam,alkaneSpherePanel);
}
示例11: ContextView
import javax.swing.BorderFactory; //导入方法依赖的package包/类
/**
*
* @author Tim Boudreau
* @author Marian Petras
*/
public ContextView(ResultModel resultModel,
ExplorerManager explorerManager) {
Border b = BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder( //outside border
0, 0, 1, 0,
UIManager.getColor("controlShadow")), //NOI18N
BorderFactory.createEmptyBorder( //inside border
5, 5, 1, 5));
lblPath.setBorder(b);
editorPane.setEditable(false);
editorPane.getCaret().setBlinkRate(0);
editorScroll = new JScrollPane(editorPane);
editorScroll.setViewportBorder(BorderFactory.createEmptyBorder());
editorScroll.setBorder(BorderFactory.createEmptyBorder());
JPanel fileViewPanel = new JPanel();
fileViewPanel.setLayout(new BorderLayout());
fileViewPanel.add(lblPath, BorderLayout.NORTH);
fileViewPanel.add(editorScroll, BorderLayout.CENTER);
Box messagePanel = Box.createVerticalBox();
messagePanel.add(Box.createVerticalGlue());
messagePanel.add(lblMessage);
messagePanel.add(Box.createVerticalGlue());
lblMessage.setAlignmentX(0.5f);
lblMessage.setHorizontalAlignment(SwingConstants.CENTER);
lblMessage.setEnabled(false);
setLayout(cardLayout = new CardLayout());
add(fileViewPanel, FILE_VIEW);
add(messagePanel, MESSAGE_VIEW);
setResultModel(resultModel);
this.explorerManager = explorerManager;
explorerManager.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("selectedNodes")) {
updateForSelection();
}
}
});
}
示例12: createBorder
import javax.swing.BorderFactory; //导入方法依赖的package包/类
/** Factory method for a line border with small insets. */
protected final Border createBorder() {
return BorderFactory.createCompoundBorder(createLineBorder(), createEmptyBorder());
}
示例13: ViewSimEnvironmentSelection
import javax.swing.BorderFactory; //导入方法依赖的package包/类
public ViewSimEnvironmentSelection(ModelSimulationEnvironment simEnvironmentObj){
super();
this.setMinimumSize(new Dimension(500,400));
SimEnvParamPanel = new JPanel();
GridBagLayout gridbagOtherParam = new GridBagLayout();
SimEnvParamPanel.setLayout(gridbagOtherParam);
this.add(SimEnvParamPanel);
closeWindow = new JButton("Cancel");
saveValues = new JButton("Save");
temperatureField = new JTextField();
temperatureField.setColumns(10);
temperatureField.setSize(new Dimension((int)temperatureField.getSize().getWidth(),20));
temperatureField.setText(Double.toString(simEnvironmentObj.getTemperature()));
JLabel temperatureLabel = new JLabel("Temperature(K)");
temperatureLabel.setLabelFor(temperatureField);
Border compoundField1;
compoundField1 = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
temperatureField.setBorder(compoundField1);
noOfStepsField = new JTextField();
noOfStepsField.setColumns(10);
JLabel NoOfStepsLabel = new JLabel("Steps");
noOfStepsField.setText(Integer.toString(simEnvironmentObj.getNoOfSteps()));
NoOfStepsLabel.setLabelFor(noOfStepsField);
Border compoundField2;
compoundField2 = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
noOfStepsField.setBorder(compoundField2);
sigmaHSRefField = new JTextField[10];
sigmaHSRefLabel = new JLabel[10];
sigmaHSRefBorder = new Border[10];
for(int i=0;i<10;i++){
sigmaHSRefField[i] = new JTextField();
sigmaHSRefField[i].setColumns(10);
String index = Integer.toString(i+1);
sigmaHSRefLabel[i] = new JLabel("SigmaHSRef"+index);
sigmaHSRefLabel[i].setLabelFor(sigmaHSRefField[i]);
if(simEnvironmentObj.getSigmaHSRef(i) == 0.0){
sigmaHSRefField[i].setText("0.0");
sigmaHSRefField[i].setVisible(false);
sigmaHSRefLabel[i].setVisible(false);
}else{
sigmaHSRefField[i].setText(Double.toString(simEnvironmentObj.getSigmaHSRef(i)));
}
sigmaHSRefBorder[i] = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
sigmaHSRefField[i].setBorder(sigmaHSRefBorder[i]);
}
JComponent[] OtherParamLeft= {temperatureLabel, NoOfStepsLabel, sigmaHSRefLabel[0],sigmaHSRefLabel[1],sigmaHSRefLabel[2],sigmaHSRefLabel[3],
sigmaHSRefLabel[4],sigmaHSRefLabel[5],sigmaHSRefLabel[6],sigmaHSRefLabel[7],
sigmaHSRefLabel[8],sigmaHSRefLabel[9],saveValues};
JComponent[] OtherParamRight = { temperatureField,noOfStepsField,sigmaHSRefField[0],sigmaHSRefField[1],sigmaHSRefField[2],sigmaHSRefField[3],
sigmaHSRefField[4],sigmaHSRefField[5],sigmaHSRefField[6],sigmaHSRefField[7],
sigmaHSRefField[8],sigmaHSRefField[8],closeWindow};
addLeftRightComponents(OtherParamLeft,OtherParamRight,gridbagOtherParam,SimEnvParamPanel);
Border compound2;
compound2 = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
SimEnvParamPanel.setBorder(compound2);
}