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:eu.europa.esig.dss.applet.util.ComponentFactory.java
/** * @param builder//from w w w. j a v a 2 s . c om * @return */ public static JPanel createPanel(final PanelBuilder builder) { final JPanel panel = builder.build(); panel.setOpaque(true); panel.setBackground(DEFAULT_BACKGROUND); return panel; }
From source file:eu.europa.esig.dss.applet.util.ComponentFactory.java
/** * @param layout/*from w ww . j a v a 2 s. co m*/ * @param bgColor * @return */ public static JPanel createPanel(final LayoutManager layout, final Color bgColor) { final JPanel panel = new JPanel(layout); panel.setOpaque(true); panel.setBackground(bgColor); return panel; }
From source file:lcmc.LCMC.java
/** Returns the main panel. */ protected static JPanel getMainPanel() { final JPanel mainPanel = new MainPanel(); Tools.getGUIData().setMainPanel(mainPanel); mainPanel.setOpaque(true); //content panes must be opaque return mainPanel; }
From source file:de.ipk_gatersleben.ag_pbi.mmd.visualisations.gradient.GradientDataChartComponent.java
public static JPanel prettifyChart(org.graffiti.graph.GraphElement ge, ChartOptions co, JFreeChart jfChart, int idx) { if (jfChart.getTitle() != null) { jfChart.getTitle().setFont(NodeTools.getChartTitleFont(ge)); jfChart.getTitle().setPaint(NodeTools.getChartTitleColor(ge)); }//from w ww . j a v a 2 s . c om ChartPanel jfreechartPanel = new ChartPanel(jfChart, false); JPanel chartPanel = jfreechartPanel; Color cbc = NodeTools.getChartBackgroundColor(ge, idx); if (cbc != null) { chartPanel.setOpaque(true); chartPanel.setBackground(cbc); } else { chartPanel.setOpaque(false); chartPanel.setBackground(null); } if (chartPanel instanceof ChartPanel) { ChartPanel cp = (ChartPanel) chartPanel; cp.setMinimumDrawHeight(300); cp.setMinimumDrawWidth(330); } if (co.borderHor > 0) chartPanel.setBorder(BorderFactory.createEmptyBorder(1, 0, 3, 0)); return chartPanel; }
From source file:eu.europa.ec.markt.dss.applet.util.ComponentFactory.java
/** * //from w ww . ja v a2 s. c o m * @param builder * @param opaque * @param bgColor * @return */ public static JPanel createPanel(final PanelBuilder builder, final boolean opaque, final Color bgColor) { final JPanel panel = builder.build(); panel.setOpaque(opaque); panel.setBackground(bgColor); return panel; }
From source file:eu.europa.ec.markt.dss.applet.util.ComponentFactory.java
/** * //from w w w . j a v a2 s . co m * @param layout * @param bgColor * @param opaque * @return */ public static JPanel createPanel(final LayoutManager layout, final boolean opaque, final Color bgColor) { final JPanel panel = new JPanel(layout); panel.setOpaque(opaque); panel.setBackground(bgColor); return panel; }
From source file:layout.SpringGrid.java
/** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread.//from w w w. jav a 2 s . c o m */ private static void createAndShowGUI() { //Create the panel and populate it. JPanel panel = new JPanel(new SpringLayout()); for (int i = 0; i < 9; i++) { JTextField textField = new JTextField(Integer.toString(i)); //Make the 4th field extra big. if (i == 4) { textField.setText("This one is extra long."); } panel.add(textField); } //Lay out the panel. SpringUtilities.makeGrid(panel, 3, 3, //rows, cols 5, 5, //initialX, initialY 5, 5);//xPad, yPad //Create and set up the window. JFrame frame = new JFrame("SpringGrid"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Set up the content pane. panel.setOpaque(true); //content panes must be opaque frame.setContentPane(panel); //Display the window. frame.pack(); frame.setVisible(true); }
From source file:SpringForm.java
/** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread./*from w w w . j a v a 2 s . c om*/ */ private static void createAndShowGUI() { String[] labels = { "Name: ", "Fax: ", "Email: ", "Address: " }; int numPairs = labels.length; //Create and populate the panel. JPanel p = new JPanel(new SpringLayout()); for (int i = 0; i < numPairs; i++) { JLabel l = new JLabel(labels[i], JLabel.TRAILING); p.add(l); JTextField textField = new JTextField(10); l.setLabelFor(textField); p.add(textField); } //Lay out the panel. SpringUtilities.makeCompactGrid(p, numPairs, 2, //rows, cols 6, 6, //initX, initY 6, 6); //xPad, yPad //Create and set up the window. JFrame frame = new JFrame("SpringForm"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Set up the content pane. p.setOpaque(true); //content panes must be opaque frame.setContentPane(p); //Display the window. frame.pack(); frame.setVisible(true); }
From source file:levelBuilder.DialogMaker.java
/** * First window to interact with. Offers options of load graph or new graph. *//*from w w w . j a v a2s .c o m*/ private static void splashWindow() { final JFrame frame = new JFrame("Dialog Maker"); //Handles button pushes. class SplashActionHandler implements ActionListener { @Override public void actionPerformed(ActionEvent e) { frame.dispose(); if (e.getActionCommand().equals("loadGraph")) loadFilePopup(); else loadGraph(true); } } //Loads and sets background image. BufferedImage img = null; try { img = ImageIO.read(new File(imgDir + "splash.png")); } catch (IOException e) { e.printStackTrace(); } final BufferedImage img2 = img; JPanel panel = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(img2, 0, 0, null); } }; panel.setOpaque(true); panel.setLayout(new BorderLayout()); panel.setPreferredSize(new Dimension(800, 600)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 300, 0)); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); buttonPanel.setOpaque(false); //Buttons JButton loadMap = new JButton("Load Graph"); loadMap.setActionCommand("loadGraph"); loadMap.addActionListener(new SplashActionHandler()); buttonPanel.add(loadMap); JButton newMap = new JButton("New Graph"); newMap.setActionCommand("newGraph"); newMap.addActionListener(new SplashActionHandler()); buttonPanel.add(newMap); panel.add(buttonPanel, BorderLayout.SOUTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel); frame.pack(); frame.setVisible(true); }
From source file:SpringGrid.java
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event-dispatching thread. *///from w w w. java 2 s . co m private static void createAndShowGUI() { // Create the panel and populate it. JPanel panel = new JPanel(new SpringLayout()); for (int i = 0; i < 9; i++) { JTextField textField = new JTextField(Integer.toString(i)); // Make the 4th field extra big. if (i == 4) { textField.setText("This one is extra long."); } panel.add(textField); } // Lay out the panel. SpringUtilities.makeGrid(panel, 3, 3, // rows, cols 5, 5, // initialX, initialY 5, 5);// xPad, yPad // Create and set up the window. JFrame frame = new JFrame("SpringGrid"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Set up the content pane. panel.setOpaque(true); // content panes must be opaque frame.setContentPane(panel); // Display the window. frame.pack(); frame.setVisible(true); }