List of usage examples for javax.swing JPanel setOpaque
@BeanProperty(expert = true, description = "The component's opacity") public void setOpaque(boolean isOpaque)
From source file:be.vds.jtbdive.client.view.core.stats.StatPanel.java
private Component createDefaultPanel() { JPanel p = new JPanel(); p.setOpaque(false); p.add(new I18nLabel("no.query.defined")); return p;//w w w . jav a 2s .co m }
From source file:probe.com.model.util.vaadintoimageutil.HeatmapSwingComponent.java
private JPanel initCell(String color, int x, int y) { JPanel cell = new JPanel(); cell.setSize(50, 50);/*from w ww.j ava2 s . c o m*/ cell.setBackground(Color.decode(color)); cell.setOpaque(true); cell.setLocation(x, y); cell.setBorder(new LineBorder(Color.WHITE)); return cell; }
From source file:MenuLookDemo.java
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);/*from w ww . jav a2 s . c o m*/ scrollPane = new JScrollPane(output); // Add the text area to the content pane. contentPane.add(scrollPane, BorderLayout.CENTER); return contentPane; }
From source file:be.vds.jtbdive.client.view.core.stats.StatPanel.java
private Component createHeader() { statWizardButton = new JButton(new AbstractAction() { private static final long serialVersionUID = -5345284505247399133L; @Override//from w ww .j a v a 2s .c om public void actionPerformed(ActionEvent e) { StatWizard wizard = new StatWizard(logBookManagerFacade); statQueryObject = wizard.launchWizard(); displayStatQueryObjectResult(); } }); statWizardButton.setIcon(UIAgent.getInstance().getIcon(UIAgent.ICON_STATISTICS_16)); statWizardButton.setEnabled(false); JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT)); p.setOpaque(false); p.add(statWizardButton); return p; }
From source file:com.intel.stl.ui.monitor.view.PSEventsPieChart.java
protected JPanel getLengendPanel() { JPanel panel = new JPanel(); panel.setOpaque(false); panel.setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); gc.fill = GridBagConstraints.BOTH; StateLongTypeViz[] states = StateLongTypeViz.values(); stateLabels = new JLabel[states.length]; for (int i = 0; i < states.length; i++) { StateLongTypeViz state = states[i]; gc.insets = new Insets(2, 5, 2, 2); gc.weightx = 0;/*from ww w . j ava 2 s. co m*/ gc.gridwidth = 1; JLabel label = new JLabel(state.getName(), Util.generateImageIcon(state.getColor(), 8, new Insets(1, 1, 1, 1)), JLabel.LEFT); label.setFont(UIConstants.H5_FONT); label.setForeground(UIConstants.INTEL_DARK_GRAY); panel.add(label, gc); gc.gridwidth = GridBagConstraints.REMAINDER; gc.weightx = 0; stateLabels[i] = new JLabel(); stateLabels[i].setForeground(UIConstants.INTEL_DARK_GRAY); stateLabels[i].setFont(UIConstants.H5_FONT); panel.add(stateLabels[i], gc); } return panel; }
From source file:MenuDemo.java
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);/*from ww w. j a va2 s . co m*/ scrollPane = new JScrollPane(output); //Add the text area to the content pane. contentPane.add(scrollPane, BorderLayout.CENTER); return contentPane; }
From source file:net.nosleep.superanalyzer.panels.HomePanel.java
public JPanel createWarningPanel(boolean showText) { JPanel panel = new JPanel(new FlowLayout()); panel.setOpaque(false); String label = null;/* w w w .j av a 2s.c o m*/ if (showText == true) label = Misc.getString("SOME_TAGS_MISSING") + "..."; URL url = this.getClass().getResource("/media/warning.png"); JButton button = new JButton(label, new ImageIcon(Toolkit.getDefaultToolkit().getImage(url))); button.setBorder(new EmptyBorder(0, 0, 0, 0)); button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showView(TagView.Id); } }); panel.add(button); return panel; }
From source file:it.iit.genomics.cru.igb.bundles.mi.business.MIWorker.java
/** * Adds a component to a JTabbedPane with a little close tab" button on the * right side of the tab.//from w w w .java 2 s. c o m * * @param tabbedPane * the JTabbedPane * @param c * any JComponent * @param title * the title for the tab */ public static void addClosableTab(final JTabbedPane tabbedPane, final JComponent c, final String title) { // Add the tab to the pane without any label tabbedPane.addTab(null, c); int pos = tabbedPane.indexOfComponent(c); // Create a FlowLayout that will space things 5px apart FlowLayout f = new FlowLayout(FlowLayout.CENTER, 5, 0); // Make a small JPanel with the layout and make it non-opaque JPanel pnlTab = new JPanel(f); pnlTab.setOpaque(false); // Add a JLabel with title and the left-side tab icon JLabel lblTitle = new JLabel(title); // Create a JButton for the close tab button JButton btnClose = new JButton("x"); // btnClose.setOpaque(false); int size = 17; btnClose.setPreferredSize(new Dimension(size, size)); btnClose.setToolTipText("close this tab"); // Make the button looks the same for all Laf's btnClose.setUI(new BasicButtonUI()); // Make it transparent btnClose.setContentAreaFilled(false); // No need to be focusable btnClose.setFocusable(false); btnClose.setBorder(BorderFactory.createEtchedBorder()); btnClose.setBorderPainted(false); // Making nice rollover effect // we use the same listener for all buttons btnClose.setRolloverEnabled(true); // Close the proper tab by clicking the button // Configure icon and rollover icon for button btnClose.setRolloverEnabled(true); // Set border null so the button doesnt make the tab too big btnClose.setBorder(null); // Make sure the button cant get focus, otherwise it looks funny btnClose.setFocusable(false); // Put the panel together pnlTab.add(lblTitle); pnlTab.add(btnClose); // Add a thin border to keep the image below the top edge of the tab // when the tab is selected pnlTab.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); // Now assign the component for the tab tabbedPane.setTabComponentAt(pos, pnlTab); // Add the listener that removes the tab ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (JOptionPane.showConfirmDialog(new JFrame(), "Are you sure you want to remove this tab? All results will be lost!", "Remove tab", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { tabbedPane.remove(c); } } }; btnClose.addActionListener(listener); // Optionally bring the new tab to the front tabbedPane.setSelectedComponent(c); }
From source file:SwingGlassExample.java
public SwingGlassExample() { super("GlassPane Demo"); setSize(500, 300);//from ww w . j a v a 2s . c om setDefaultCloseOperation(EXIT_ON_CLOSE); // Now set up a few buttons & images for the main application JPanel mainPane = new JPanel(); mainPane.setBackground(Color.white); JButton redB = new JButton("Red"); JButton blueB = new JButton("Blue"); JButton greenB = new JButton("Green"); mainPane.add(redB); mainPane.add(greenB); mainPane.add(blueB); mainPane.add(new JLabel(new ImageIcon("oreilly.gif"))); // Attach the popup debugger to the main app buttons so you // see the effect of making a glass pane visible PopupDebugger pd = new PopupDebugger(this); redB.addActionListener(pd); greenB.addActionListener(pd); blueB.addActionListener(pd); // And last but not least, our button to launch the glass pane JButton startB = new JButton("Start the big operation!"); startB.addActionListener(new ActionListener() { public void actionPerformed(java.awt.event.ActionEvent A) { // manually control the 1.2/1.3 bug work-around glass.setNeedToRedispatch(false); glass.setVisible(true); startTimer(); } }); Container contentPane = getContentPane(); contentPane.add(mainPane, BorderLayout.CENTER); contentPane.add(startB, BorderLayout.SOUTH); // Set up the glass pane with a little message and a progress bar... JPanel controlPane = new JPanel(new GridLayout(2, 1)); controlPane.setOpaque(false); controlPane.add(new JLabel("Please wait...")); controlPane.add(waiter); glass = new FixedGlassPane(getJMenuBar(), getContentPane()); glass.setLayout(new GridLayout(0, 1)); glass.setOpaque(false); glass.add(new JLabel()); // padding... glass.add(new JLabel()); glass.add(controlPane); glass.add(new JLabel()); glass.add(new JLabel()); setGlassPane(glass); }
From source file:es.emergya.ui.gis.popups.ListaCapas.java
private void addCapa(final GpxLayer layer) { final JPanel capaP = new JPanel(); capaP.setOpaque(false); layer.visible = true;/* ww w. jav a 2 s. c o m*/ mapView.addLayer(layer, false, capasActuales.size()); capasActuales.add(layer); capaP.setLayout(new BoxLayout(capaP, BoxLayout.X_AXIS)); final JCheckBox capa = new JCheckBox(layer.getAssociatedFile().getAbsolutePath()); capa.setSelected(layer.visible); capa.setBackground(Color.WHITE); capa.setToolTipText(i18n.getString("window.gpx.checkbox.show.tooltip")); capa.setActionCommand(layer.name); capa.addActionListener(this); capaP.add(capa); capaP.add(Box.createHorizontalGlue()); JButton eliminar = new JButton(LogicConstants.getIcon("button_delone")); eliminar.setToolTipText(i18n.getString("window.gpx.button.delete.tooltip")); eliminar.setBorderPainted(false); eliminar.setContentAreaFilled(false); capaP.add(eliminar); eliminar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mapView.removeLayer(layer); mapView.repaint(); capasGpx.remove(capaP); capasGpx.updateUI(); capasActuales.remove(layer); } }); capasGpx.add(capaP); capasGpx.updateUI(); }