本文整理汇总了Java中javax.swing.JPanel.setOpaque方法的典型用法代码示例。如果您正苦于以下问题:Java JPanel.setOpaque方法的具体用法?Java JPanel.setOpaque怎么用?Java JPanel.setOpaque使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JPanel
的用法示例。
在下文中一共展示了JPanel.setOpaque方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSoundsJPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
/**
* @return
*/
final private JPanel getSoundsJPanel() {
final JPanel objLsoundsJCheckBoxesJPanel = new JPanel(new GridBagLayout());
objLsoundsJCheckBoxesJPanel.setOpaque(true);
final ExtendedGridBagConstraints objLjCheckBoxesExtendedGridBagConstraints = new ExtendedGridBagConstraints(GridBagConstraints.RELATIVE, 0);
objLsoundsJCheckBoxesJPanel.add(this.objGbooleanLocalJCheckBoxA[PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_SOUNDS]);
final JPanel objLsoundsJCheckBoxJPanel = new JPanel();
objLsoundsJCheckBoxJPanel.setLayout(new BoxLayout(objLsoundsJCheckBoxJPanel, BoxLayout.LINE_AXIS));
objLsoundsJCheckBoxJPanel.add(this.objGbooleanLocalJLabelA[PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_SOUNDS]);
objLsoundsJCheckBoxJPanel.add(new JLabel(" :"));
objLsoundsJCheckBoxesJPanel.add(objLsoundsJCheckBoxJPanel, objLjCheckBoxesExtendedGridBagConstraints);
byte bytLposY = 1;
for (final byte bytLbooleanLocalIndex : new byte[] { PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_CATCH_SOUNDS,
PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_THROW_SOUNDS, PreferencesJDialog.bytS_BOOLEAN_LOCAL_PREFERENCE_METRONOME }) {
final JPanel objLjPanel = new JPanel();
objLjPanel.setLayout(new BoxLayout(objLjPanel, BoxLayout.LINE_AXIS));
objLjPanel.add(this.objGbooleanLocalJCheckBoxA[bytLbooleanLocalIndex]);
objLjPanel.add(this.objGbooleanLocalJLabelA[bytLbooleanLocalIndex]);
this.setSoundsJLabelsEnabled();
objLjCheckBoxesExtendedGridBagConstraints.setGridLocation(1, bytLposY++);
objLsoundsJCheckBoxesJPanel.add(objLjPanel, objLjCheckBoxesExtendedGridBagConstraints);
}
return objLsoundsJCheckBoxesJPanel;
}
示例2: getListCellRendererComponent
import javax.swing.JPanel; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(JList<? extends Record> recordList, Record record, int index,
boolean selected, boolean focus) {
JPanel panel = new JPanel(new BorderLayout(10, 10));
JLabel lTitulo = new JLabel(record.getName());
lTitulo.setFont(new Font("Arial", Font.CENTER_BASELINE, 16));
lTitulo.setForeground(selected ? Color.WHITE : Color.BLACK);
panel.add(lTitulo, BorderLayout.CENTER);
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
panel.setBackground(selected ? new Color(255, 107, 107) : Color.WHITE);
panel.setOpaque(true);
return panel;
}
示例3: buildBottomContent
import javax.swing.JPanel; //导入方法依赖的package包/类
protected JComponent buildBottomContent() {
WebLink news = new WebLink("AllNews", true); // NOI18N
BundleSupport.setAccessibilityProperties( news, "AllNews" ); //NOI18N
WebLink articles = new WebLink( "AllArticles", true); // NOI18N
BundleSupport.setAccessibilityProperties( articles, "AllArticles" ); //NOI18N
JPanel panel = new JPanel( new GridBagLayout() );
panel.setOpaque(false);
panel.add( news, new GridBagConstraints(0,1,1,1,0.0,0.0,
GridBagConstraints.SOUTHWEST,GridBagConstraints.HORIZONTAL,
new Insets(5,0,0,15),0,0) );
panel.add( new JLabel(), new GridBagConstraints(1,1,1,1,1.0,0.0,
GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,
new Insets(5,5,0,0),0,0) );
panel.add( articles, new GridBagConstraints(2,1,1,1,0.0,0.0,
GridBagConstraints.SOUTHEAST,GridBagConstraints.HORIZONTAL,
new Insets(5,5,0,0),0,0) );
return panel;
}
示例4: update
import javax.swing.JPanel; //导入方法依赖的package包/类
/**
* Updates this {@code InfoPanel}.
*
* @param mapTransform The current MapTransform.
*/
public void update(MapTransform mapTransform) {
final JPanel p = (mapTransform == null) ? null
: mapTransform.getDescriptionPanel();
if (p != null) {
p.setOpaque(false);
final Dimension d = p.getPreferredSize();
p.setBounds(0, (this.mapEditorPanel.getHeight() - d.height)/2,
this.mapEditorPanel.getWidth(), d.height);
this.mapEditorPanel.removeAll();
this.mapEditorPanel.add(p, BorderLayout.CENTER);
this.mapEditorPanel.validate();
this.mapEditorPanel.revalidate();
}
update();
}
示例5: defaultHeight
import javax.swing.JPanel; //导入方法依赖的package包/类
private static int defaultHeight() {
if (DEFAULT_HEIGHT == -1) {
JPanel ref = new JPanel(null);
ref.setLayout(new BoxLayout(ref, BoxLayout.LINE_AXIS));
ref.setOpaque(false);
ref.add(new JLabel("XXX")); // NOI18N
ref.add(new JButton("XXX")); // NOI18N
ref.add(new PopupButton("XXX")); // NOI18N
ref.add(new JCheckBox("XXX")); // NOI18N
ref.add(new JRadioButton("XXX")); // NOI18N
ref.add(new JTextField("XXX")); // NOI18N
ref.add(new JExtendedSpinner(new SpinnerNumberModel(1, 1, 655535, 1)));
Component separator = Box.createHorizontalStrut(1);
Dimension d = separator.getMaximumSize(); d.height = 20;
separator.setMaximumSize(d);
ref.add(separator);
DEFAULT_HEIGHT = ref.getPreferredSize().height;
}
return DEFAULT_HEIGHT;
}
示例6: initialize
import javax.swing.JPanel; //导入方法依赖的package包/类
/**
* Initialize the panel
*/
private void initialize() {
// Initialize dialog layout
JPanel panel = new JPanel(new BorderLayout(BORDERSIZE / 2, BORDERSIZE / 2));
panel.setBorder(BorderFactory.createEmptyBorder(BORDERSIZE, BORDERSIZE, BORDERSIZE, BORDERSIZE));
// Adds website image
JPanel tmpPanel = new JPanel(new BorderLayout(BORDERSIZE, BORDERSIZE));
// Adds polimi description
HtmlPanel titleLabel = new HtmlPanel();
titleLabel.setText(GraphStartScreen.HTML_CONTENT_TITLE_HREF);
titleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
titleLabel.setAlignmentY(Component.CENTER_ALIGNMENT);
titleLabel.setOpaque(false);
tmpPanel.add(titleLabel, BorderLayout.CENTER);
// Adds application title
title = new JLabel();
title.setHorizontalTextPosition(SwingConstants.RIGHT);
title.setHorizontalAlignment(SwingConstants.CENTER);
title.setIconTextGap(BORDERSIZE);
tmpPanel.add(title, BorderLayout.SOUTH);
panel.add(tmpPanel, BorderLayout.NORTH);
// Adds text area
mainArea = new JPanel();
mainArea.setOpaque(false);
BoxLayout mainLayout = new BoxLayout(mainArea, BoxLayout.Y_AXIS);
mainArea.setLayout(mainLayout);
panel.add(mainArea, BorderLayout.CENTER);
JLabel legal = new JLabel(LEGAL);
panel.add(legal, BorderLayout.SOUTH);
panel.setPreferredSize(new Dimension(600,480));
JScrollPane scroll = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
this.add(scroll, BorderLayout.CENTER);
}
示例7: buildContent
import javax.swing.JPanel; //导入方法依赖的package包/类
@Override
protected JComponent buildContent() {
JPanel main = new JPanel( new GridLayout(1,0) );
main.setOpaque(false);
main.setBorder(BorderFactory.createEmptyBorder());
main.add( new ContentSection( BundleSupport.getLabel( "SectionNewsAndTutorials" ), //NOI18N
new ArticlesAndNews(), true ));
main.add( new ContentSection( BundleSupport.getLabel( "SectionBlogs" ), //NOI18N
new Blogs(), true ) );
return main;
}
示例8: CrosshairWindow
import javax.swing.JPanel; //导入方法依赖的package包/类
public CrosshairWindow() {
super.setLocation(-10, -10);
setSize(16,16);
setBackground(new Color(0,0,255,0));
JPanel crosshairPanel = new CrosshairPanel();
crosshairPanel.setOpaque(false);
add(crosshairPanel);
centre = new Point(8,8);
setAlwaysOnTop(true);
}
示例9: createContentPane
import javax.swing.JPanel; //导入方法依赖的package包/类
public Container createContentPane() {
//Create the content-pane-to-be.
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.setOpaque(true);
//Create a scrolled text area.
output = new JTextArea(5, 30);
output.setEditable(false);
scrollPane = new JScrollPane(output);
//Add the text area to the content pane.
contentPane.add(scrollPane, BorderLayout.CENTER);
return contentPane;
}
示例10: buildProxyPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
private JComponent buildProxyPanel() {
Component header = getContentHeader();
JPanel panel = new JPanel(new GridBagLayout());
panel.setOpaque( false );
int row = 0;
if( null != header ) {
panel.add( header, new GridBagConstraints(0,row++,1,1,1.0,0.0,
GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
}
panel.add( new JLabel(BundleSupport.getLabel("ErrCannotConnect")), // NOI18N
new GridBagConstraints(0,row++,1,1,0.0,0.0,
GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
if( showProxyButton ) {
JButton button = new JButton();
Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "ProxyConfig" ) ); // NOI18N
button.setOpaque( false );
button.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
HttpProxySettings.getDefault().showConfigurationDialog();
}
});
panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
}
return panel;
}
示例11: recordPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
private Component recordPanel() {
JPanel panel = new JPanel(new BorderLayout(0, 5));
panel.setOpaque(false);
panel.add(titlePanel(), BorderLayout.NORTH);
panel.add(listPanel(), BorderLayout.CENTER);
return panel;
}
示例12: topPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
private Component topPanel() {
JPanel panel = new JPanel(new FlowLayout());
panel.setBorder(BorderFactory.createEmptyBorder(28, 0, 0, 0));
panel.setOpaque(false);
statusImage = new JLabel(new ImageIcon(References.STANDBY_IMAGE));
panel.add(statusImage);
return panel;
}
示例13: ANOVAMatrixViewer
import javax.swing.JPanel; //导入方法依赖的package包/类
public ANOVAMatrixViewer(ANOVAMatrix matrix) {
super(new BorderLayout());
JPanel panel = new JPanel(new GridBagLayout());
panel.setOpaque(true);
panel.setBackground(Colors.WHITE);
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(42, 10, 20, 10);
// table
ANOVAMatrixViewerTable table = new ANOVAMatrixViewerTable(matrix);
table.getTableHeader().putClientProperty(RapidLookTools.PROPERTY_TABLE_HEADER_BACKGROUND, Colors.WHITE);
((TableHeaderUI) table.getTableHeader().getUI()).installDefaults();
table.setRowHighlighting(true);
table.setRowHeight(PropertyPanel.VALUE_CELL_EDITOR_HEIGHT);
JScrollPane scrollPane = new ExtendedJScrollPane(table);
scrollPane.setBorder(null);
scrollPane.setBackground(Colors.WHITE);
scrollPane.getViewport().setBackground(Colors.WHITE);
panel.add(scrollPane, gbc);
// info string
JLabel infoText = new JLabel();
infoText.setText("A colored background indicates that the probability for non-difference between the groups is less than "
+ Tools.formatNumber(matrix.getSignificanceLevel()));
gbc.gridy += 1;
gbc.insets = new Insets(5, 10, 5, 10);
gbc.weighty = 0.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(infoText, gbc);
add(panel, BorderLayout.CENTER);
}
示例14: Sectors3DPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
/**
* Builds a new Sectors3D Panel to show results of 3-class models
* @param s3d results vector
* @param classNames array with class names
*/
public Sectors3DPanel(Vector<Object> s3d, String[] classNames) {
super(new BorderLayout());
this.s3d = s3d;
this.classNames = classNames;
this.setBackground(BGCOLOR);
this.setBorder(BorderFactory.createEtchedBorder());
// Label to show coordinates
coordLabel = new JLabel();
coordLabel.setBorder(BorderFactory.createEtchedBorder());
coordLabel.setVisible(false);
coordLabel.setOpaque(true);
// Puts label on south-east corner
JPanel tmp = new JPanel(new BorderLayout());
tmp.add(coordLabel, BorderLayout.EAST);
tmp.setOpaque(false);
this.add(tmp, BorderLayout.SOUTH);
// Adds a mouseListener to show graph coordinates
this.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
if (isShown) {
String coord = getCoordinates(e.getX(), e.getY());
if (coord != null) {
coordLabel.setText(coord);
coordLabel.setVisible(true);
Sectors3DPanel.this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
} else {
coordLabel.setText("");
coordLabel.setVisible(false);
Sectors3DPanel.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
}
});
}
示例15: getColorsJPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
final private JPanel getColorsJPanel() {
final JPanel objLpreferencesColorsJPanel = new JPanel(new GridBagLayout());
objLpreferencesColorsJPanel.setOpaque(true);
final ExtendedGridBagConstraints objLcolorsJLabelsExtendedGridBagConstraints =
new ExtendedGridBagConstraints( 0,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.EAST,
10,
10,
10,
5);
final ExtendedGridBagConstraints objLcolorsJButtonsExtendedGridBagConstraints =
new ExtendedGridBagConstraints( 1,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.WEST,
Constants.objS_GRAPHICS_FONT_METRICS.getAscent(),
Constants.objS_GRAPHICS_FONT_METRICS.getAscent(),
10,
10,
0,
10);
for (byte bytLpreferenceIndex = 0; bytLpreferenceIndex < PreferencesJDialog.bytS_STRING_LOCAL_PREFERENCES_NUMBER; ++bytLpreferenceIndex) {
if (bytLpreferenceIndex == PreferencesJDialog.bytS_STRING_LOCAL_PREFERENCES_NUMBER / 2) {
objLcolorsJLabelsExtendedGridBagConstraints.setGridBounds(2, GridBagConstraints.RELATIVE, 1, 1);
objLcolorsJButtonsExtendedGridBagConstraints.setGridBounds(3, GridBagConstraints.RELATIVE, 1, 1);
}
objLpreferencesColorsJPanel.add(this.objGstringLocalJLabelA[bytLpreferenceIndex], objLcolorsJLabelsExtendedGridBagConstraints);
objLpreferencesColorsJPanel.add(this.objGstringLocalColorJButtonA[bytLpreferenceIndex], objLcolorsJButtonsExtendedGridBagConstraints);
}
return objLpreferencesColorsJPanel;
}