本文整理了Java中javax.swing.JPanel.setOpaque()
方法的一些代码示例,展示了JPanel.setOpaque()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.setOpaque()
方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:setOpaque
暂无
代码示例来源:origin: stackoverflow.com
tabPane.addTab(title, tabBody);
int index = tabPane.indexOfTab(title);
JPanel pnlTab = new JPanel(new GridBagLayout());
pnlTab.setOpaque(false);
JLabel lblTitle = new JLabel(title);
JButton btnClose = new JButton("x");
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1;
pnlTab.add(lblTitle, gbc);
gbc.gridx++;
gbc.weightx = 0;
pnlTab.add(btnClose, gbc);
tabPane.setTabComponentAt(index, pnlTab);
btnClose.addActionListener(myCloseActionHandler);
代码示例来源:origin: stackoverflow.com
ShowImage panel = new ShowImage();
panel.setBackground(Color.RED);
setContentPane(new ContentPane());
getContentPane().setBackground(Color.BLACK);
setLayout(new BorderLayout());
add(panel);
JPanel pnlButtOns= new JPanel(new FlowLayout(FlowLayout.RIGHT));
pnlButtons.setOpaque(false);
pnlButtons.add(new JButton("<<"));
pnlButtons.add(new JButton("<"));
pnlButtons.add(new JButton(">"));
pnlButtons.add(new JButton(">>"));
// Okay, in theory, getContentPane() is required, but better safe the sorry
getContentPane().add(pnlButtons, BorderLayout.SOUTH);
setVisible(true);
代码示例来源:origin: log4j/log4j
public CategoryNodeRenderer() {
_panel.setBackground(UIManager.getColor("Tree.textBackground"));
if (_sat == null) {
// Load the satellite image.
String resource =
"/org/apache/log4j/lf5/viewer/images/channelexplorer_satellite.gif";
URL satURL = getClass().getResource(resource);
_sat = new ImageIcon(satURL);
}
setOpaque(false);
_checkBox.setOpaque(false);
_panel.setOpaque(false);
// The flowlayout set to LEFT is very important so that the editor
// doesn't jump around.
_panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
_panel.add(_checkBox);
_panel.add(this);
setOpenIcon(_sat);
setClosedIcon(_sat);
setLeafIcon(_sat);
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
private void setBottomPanel() {
final JPanel panel = new JPanel(new BorderLayout());
panel.add(new JSeparator(), BorderLayout.NORTH);
SizeGrip sg = new SizeGrip();
panel.add(sg, BorderLayout.LINE_END);
MouseInputAdapter adapter = new MouseInputAdapter() {
private Point lastPoint;
panel.setOpaque(false);
JLabel label = new JLabel(FocusableTip.getString("FocusHotkey"));
Color fg = UIManager.getColor("Label.disabledForeground");
Font fOnt= textArea.getFont();
label.setHorizontalAlignment(SwingConstants.TRAILING);
label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
panel.add(label);
panel.addMouseListener(tipListener);
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Create a Panel around a component so that component aligns to left.
*
* @param object the component
* @return a Panel
*/
public static JPanel createLeftPanel(Component object) {
JPanel ret = new NullPanel(new BorderLayout());
ret.setOpaque(false);
ret.add(object, BorderLayout.BEFORE_LINE_BEGINS);
return ret;
}
代码示例来源:origin: stackoverflow.com
private JFrame frame = new JFrame();
private JLayeredPane lpane = new JLayeredPane();
private JPanel panelBlue = new JPanel();
private JPanel panelGreen = new JPanel();
public Main()
frame.setLayout(new BorderLayout());
frame.add(lpane, BorderLayout.CENTER);
lpane.setBounds(0, 0, 600, 400);
panelBlue.setBackground(Color.BLUE);
panelBlue.setBounds(0, 0, 600, 400);
panelBlue.setOpaque(true);
panelGreen.setBackground(Color.GREEN);
panelGreen.setBounds(200, 100, 100, 100);
panelGreen.setOpaque(true);
lpane.add(panelBlue, new Integer(0), 0);
lpane.add(panelGreen, new Integer(1), 0);
代码示例来源:origin: jshiell/checkstyle-idea
copyLibsCheckbox.setToolTipText(CheckStyleBundle.message("config.stabilize-classpath.tooltip"));
final JPanel cOnfigFilePanel= new JPanel(new GridBagLayout());
configFilePanel.setOpaque(false);
configFilePanel.add(csVersionDropdownLabel, new GridBagConstraints(
0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, COMPONENT_INSETS, 0, 0));
configFilePanel.add(csVersionDropdown, new GridBagConstraints(
1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, COMPONENT_INSETS, 0, 0));
configFilePanel.add(scopeDropdownLabel, new GridBagConstraints(
2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.NONE, COMPONENT_INSETS, 0, 0));
代码示例来源:origin: stackoverflow.com
JPanel panel = new JPanel(new GridLayout(0, 1));
panel.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
panel.setBackground(Color.YELLOW);
panel.add(new JLabel("I am message Label"));
panel.add(new JButton("CLOSE"));
JPanel glassPanel = new JPanel(new GridBagLayout());
glassPanel.setOpaque(false);
glassPanel.add(panel);
代码示例来源:origin: tomighty/tomighty
private static final JPanel createPanel(LayoutManager layout) {
JPanel panel = new JPanel(layout);
panel.setOpaque(false);
return panel;
}
代码示例来源:origin: magefree/mage
/**
* Get the panel where all arrows are being drawn.
* @return
*/
public synchronized JPanel getArrowsManagerPanel() {
if (arrowsManagerPanel == null) {
arrowsManagerPanel = new JPanel();
arrowsManagerPanel.setVisible(true);
arrowsManagerPanel.setOpaque(false);
arrowsManagerPanel.setLayout(null);
}
return arrowsManagerPanel;
}
代码示例来源:origin: ron190/jsql-injection
public AbstractManagerList(String nameFile) {
this.setLayout(new BorderLayout());
try {
InputStream in = AbstractManagerList.class.getResourceAsStream("/com/jsql/view/swing/resources/list/"+ nameFile);
String line;
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
while ((line = reader.readLine()) != null) {
this.itemsList.add(new ItemList(line));
}
reader.close();
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
}
this.listFile = new DnDList(this.itemsList);
this.listFile.setBorder(BorderFactory.createEmptyBorder(0, 0, LightScrollPane.THUMB_SIZE, 0));
this.add(new LightScrollPane(1, 0, 0, 0, this.listFile), BorderLayout.CENTER);
this.lastLine.setOpaque(false);
this.lastLine.setLayout(new BoxLayout(this.lastLine, BoxLayout.X_AXIS));
this.lastLine.setBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(0, 0, 0, 0, HelperUi.COLOR_COMPONENT_BORDER),
BorderFactory.createEmptyBorder(1, 0, 1, 1)
)
);
}
代码示例来源:origin: skylot/jadx
String name = node.makeLongString();
final JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 0));
panel.setOpaque(false);
final JLabel label = new JLabel(name);
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
label.setIcon(node.getIcon());
panel.add(label);
panel.add(button);
panel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
return panel;
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Create a Panel around a component so that component aligns to top.
*
* @param object the component
* @return a Panel
*/
public static JPanel createTopPanel(Component object) {
JPanel ret = new NullPanel(new BorderLayout());
ret.setOpaque(false);
ret.add(object, BorderLayout.BEFORE_FIRST_LINE);
return ret;
}
代码示例来源:origin: stackoverflow.com
frame.setLayout(new BorderLayout());
frame.add(new TestPane());
frame.pack();
setBorder(new EmptyBorder(20, 20, 20, 20));
setLayout(new BorderLayout());
JPanel drop = new JPanel();
drop.setOpaque(false);
DropShadowBorder border = new DropShadowBorder();
border.setFillContentArea(true);
代码示例来源:origin: magefree/mage
this.buttonGrid.setLayout(new FlowLayout(FlowLayout.CENTER, BUTTONS_H_GAP, 0));
this.buttonGrid.setPreferredSize(null);
case Constants.BATTLEFIELD_FEEDBACK_COLORIZING_MODE_DISABLE:
this.mainPanel.setOpaque(false);
this.mainPanel.setBorder(null);
break;
this.mainPanel.setOpaque(true);
this.mainPanel.setBackground(ACTIVE_FEEDBACK_BACKGROUND_COLOR_OTHER);
break;
this.mainPanel.setOpaque(true);
Color backColor = ACTIVE_FEEDBACK_BACKGROUND_COLOR_OTHER;
if (this.gameTurnPhase != null) {
this.mainPanel.setOpaque(false);
this.buttonGrid.add(button);
this.buttonGrid.setLayout(gl);
this.buttonGrid.setPreferredSize(new Dimension(constGridSizeW, constGridSizeH));
} else {
代码示例来源:origin: stackoverflow.com
JFrame f = new JFrame();
f.setLayout(null);
f.setDefaultCloseOperation(3);
f.setSize(500, 500);
JPanel p = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Dimension arcs = new Dimension(15,15);
int width = getWidth();
int height = getHeight();
Graphics2D graphics = (Graphics2D) g;
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//Draws the rounded opaque panel with borders.
graphics.setColor(getBackground());
graphics.fillRoundRect(0, 0, width-1, height-1, arcs.width, arcs.height);//paint background
graphics.setColor(getForeground());
graphics.drawRoundRect(0, 0, width-1, height-1, arcs.width, arcs.height);//paint border
}
};
p.setBounds(10,10,100,30);
p.setOpaque(false);
f.getContentPane().setBackground(Color.red);
f.add(p);
f.show();
代码示例来源:origin: libgdx/libgdx
appliedEffectsPanel.add(this, constrains);
JPanel titlePanel = new JPanel();
titlePanel.setLayout(new LayoutManager() {
public void removeLayoutComponent (Component comp) {
titlePanel.add(upButton);
upButton.setText("Up");
upButton.setMargin(new Insets(0, 0, 0, 0));
titlePanel.add(downButton);
downButton.setText("Down");
downButton.setMargin(new Insets(0, 0, 0, 0));
nameLabel = new JLabel(effect.toString());
titlePanel.add(nameLabel);
Font fOnt= nameLabel.getFont();
add(titlePanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(5, 0, 0, 5), 0, 0));
titlePanel.setOpaque(false);
valuesPanel = new JPanel();
valuesPanel.setOpaque(false);
valuesPanel.setLayout(new GridBagLayout());
add(valuesPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 10, 5, 0), 0, 0));
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Create a Panel around a component so that component aligns to right.
*
* @param object the component
* @return a Panel
*/
public static JPanel createRightPanel(Component object) {
JPanel ret = new NullPanel(new BorderLayout());
ret.setOpaque(false);
ret.add(object, BorderLayout.AFTER_LINE_ENDS);
return ret;
}
代码示例来源:origin: magefree/mage
/** Creates new form CombatDialog */
public CombatDialog() {
JPanel cOntentPane= new JPanel() {
private static final long serialVersiOnUID= -8283955788355547309L;
public void paintComponent(Graphics g) {
g.setColor(new Color(50, 50, 50, 100));
g.fillRect(0, 0, getWidth(), getHeight());
}
};
setContentPane(contentPane);
initComponents();
this.setModal(false);
combatArea.setOpaque(false);
jScrollPane1.setOpaque(false);
jScrollPane1.getViewport().setOpaque(false);
getRootPane().setOpaque(false);
//setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
}
代码示例来源:origin: libgdx/libgdx
appliedEffectsPanel.add(this, constrains);
JPanel titlePanel = new JPanel();
titlePanel.setLayout(new LayoutManager() {
public void removeLayoutComponent (Component comp) {
titlePanel.add(upButton);
upButton.setText("Up");
upButton.setMargin(new Insets(0, 0, 0, 0));
titlePanel.add(downButton);
downButton.setText("Down");
downButton.setMargin(new Insets(0, 0, 0, 0));
nameLabel = new JLabel(effect.toString());
titlePanel.add(nameLabel);
Font fOnt= nameLabel.getFont();
add(titlePanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(5, 0, 0, 5), 0, 0));
titlePanel.setOpaque(false);
valuesPanel = new JPanel();
valuesPanel.setOpaque(false);
valuesPanel.setLayout(new GridBagLayout());
add(valuesPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 10, 5, 0), 0, 0));