热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

javax.swing.JPanel.setOpaque()方法的使用及代码示例

本文整理了Java中javax.swing.JPanel.setOpaque()方法的一些代码示例,展示了JPanel.setOpaque()

本文整理了Java中javax.swing.JPanel.setOpaque()方法的一些代码示例,展示了JPanel.setOpaque()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.setOpaque()方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:setOpaque

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));

推荐阅读
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • Go GUIlxn/walk 学习3.菜单栏和工具栏的具体实现
    本文介绍了使用Go语言的GUI库lxn/walk实现菜单栏和工具栏的具体方法,包括消息窗口的产生、文件放置动作响应和提示框的应用。部分代码来自上一篇博客和lxn/walk官方示例。文章提供了学习GUI开发的实际案例和代码示例。 ... [详细]
  • 本文介绍了一个适用于PHP应用快速接入TRX和TRC20数字资产的开发包,该开发包支持使用自有Tron区块链节点的应用场景,也支持基于Tron官方公共API服务的轻量级部署场景。提供的功能包括生成地址、验证地址、查询余额、交易转账、查询最新区块和查询交易信息等。详细信息可参考tron-php的Github地址:https://github.com/Fenguoz/tron-php。 ... [详细]
  • 带添加按钮的GridView,item的删除事件
    先上图片效果;gridView无数据时显示添加按钮,有数据时,第一格显示添加按钮,后面显示数据:布局文件:addr_manage.xml<?xmlve ... [详细]
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • Android日历提醒软件开源项目分享及使用教程
    本文介绍了一款名为Android日历提醒软件的开源项目,作者分享了该项目的代码和使用教程,并提供了GitHub项目地址。文章详细介绍了该软件的主界面风格、日程信息的分类查看功能,以及添加日程提醒和查看详情的界面。同时,作者还提醒了读者在使用过程中可能遇到的Android6.0权限问题,并提供了解决方法。 ... [详细]
  • 本文整理了Java中org.gwtbootstrap3.client.ui.Icon.addDomHandler()方法的一些代码示例,展示了Icon.ad ... [详细]
  • 今日份分享:Flutter自定义之旋转木马
    今日份分享:Flutter自定义之旋转木马-先上图,带你回到童年时光:效果分析子布局按照圆形顺序放置且平分角度子布局旋转、支持手势滑动旋转、快速滑动抬手继续旋转、自动旋转支持X轴旋 ... [详细]
  • 本文整理了Java中org.apache.pig.backend.executionengine.ExecException.<init>()方法的一些代码 ... [详细]
  • [译]技术公司十年经验的职场生涯回顾
    本文是一位在技术公司工作十年的职场人士对自己职业生涯的总结回顾。她的职业规划与众不同,令人深思又有趣。其中涉及到的内容有机器学习、创新创业以及引用了女性主义者在TED演讲中的部分讲义。文章表达了对职业生涯的愿望和希望,认为人类有能力不断改善自己。 ... [详细]
  • baresip android编译、运行教程1语音通话
    本文介绍了如何在安卓平台上编译和运行baresip android,包括下载相关的sdk和ndk,修改ndk路径和输出目录,以及创建一个c++的安卓工程并将目录考到cpp下。详细步骤可参考给出的链接和文档。 ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • 本文介绍了Python字典视图对象的示例和用法。通过对示例代码的解释,展示了字典视图对象的基本操作和特点。字典视图对象可以通过迭代或转换为列表来获取字典的键或值。同时,字典视图对象也是动态的,可以反映字典的变化。通过学习字典视图对象的用法,可以更好地理解和处理字典数据。 ... [详细]
author-avatar
款款迷恋_420
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有