我在自定义 jdialog 中使用 JSeparator
这是我的代码:
public class CheckDialog extends javax.swing.JDialog {
private boolean setuju =false;
public CheckDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
JSeparator jSeparator4 = new JSeparator(SwingConstants.HORIZONTAL);
JSeparator jSeparator6 = new JSeparator(SwingConstants.HORIZONTAL);
JSeparator jSeparator7 = new JSeparator(SwingConstants.HORIZONTAL);
jSeparator4.setBackground(new java.awt.Color(0, 0, 51));
jSeparator4.setForeground(new java.awt.Color(0, 0, 51));
jPanel2.add(jSeparator4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, 280, 10));
jSeparator6.setBackground(new java.awt.Color(0, 0, 51));
jSeparator6.setForeground(new java.awt.Color(0, 0, 51));
jPanel10.add(jSeparator6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, 40, 10));
jSeparator7.setBackground(new java.awt.Color(0, 0, 51));
jSeparator7.setForeground(new java.awt.Color(0, 0, 51));
jPanel1.add(jSeparator7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, 110, 10));
}
public boolean showDialog() {
this.setUndecorated(true);
this.pack();
this.setBackground(new Color(0,0,0,0));
this.setLocationRelativeTo(null);
this.setVisible(true);
return setuju;
}
}
我希望分隔符颜色应该是 (0, 0, 51) 但分隔符保持其默认颜色,例如 (212, 212, 212)。