List of usage examples for javax.swing JFrame setContentPane
@BeanProperty(bound = false, hidden = true, description = "The client area of the frame where child components are normally inserted.") public void setContentPane(Container contentPane)
contentPane
property. From source file:Main.java
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event-dispatching thread. *//*from www .j av a 2 s . c o m*/ private static void createAndShowGUI() { // Create and set up the window. JFrame frame = new JFrame("ListDataEventDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Create and set up the content pane. JComponent newContentPane = new Main(); newContentPane.setOpaque(true); // content panes must be opaque frame.setContentPane(newContentPane); // Don't let the content pane get too small. // (Works if the Java look and feel provides // the window decorations.) newContentPane.setMinimumSize(new Dimension(newContentPane.getPreferredSize().width, 100)); // Display the window. frame.pack(); frame.setVisible(true); }
From source file:ListDataEventDemo.java
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event-dispatching thread. *//* w w w .j a va 2s . com*/ private static void createAndShowGUI() { // Create and set up the window. JFrame frame = new JFrame("ListDataEventDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Create and set up the content pane. JComponent newContentPane = new ListDataEventDemo(); newContentPane.setOpaque(true); // content panes must be opaque frame.setContentPane(newContentPane); // Don't let the content pane get too small. // (Works if the Java look and feel provides // the window decorations.) newContentPane.setMinimumSize(new Dimension(newContentPane.getPreferredSize().width, 100)); // Display the window. frame.pack(); frame.setVisible(true); }
From source file:Main.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 ava 2 s .c om */ private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("ProgressMonitorDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = new Main(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
From source file:ProgressBarDemo.java
/** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread./*ww w . j a va2s. co m*/ */ private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("ProgressBarDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = new ProgressBarDemo(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
From source file:com.heliosdecompiler.bootstrapper.Bootstrapper.java
private static HeliosData loadHelios() throws IOException { System.out.println("Finding Helios implementation"); HeliosData data = new HeliosData(); boolean needsToDownload = !IMPL_FILE.exists(); if (!needsToDownload) { try (JarFile jarFile = new JarFile(IMPL_FILE)) { ZipEntry entry = jarFile.getEntry("META-INF/MANIFEST.MF"); if (entry == null) { needsToDownload = true;//from w w w . j a va2s . c o m } else { Manifest manifest = new Manifest(jarFile.getInputStream(entry)); String ver = manifest.getMainAttributes().getValue("Implementation-Version"); try { data.buildNumber = Integer.parseInt(ver); data.version = manifest.getMainAttributes().getValue("Version"); data.mainClass = manifest.getMainAttributes().getValue("Main-Class"); } catch (NumberFormatException e) { needsToDownload = true; } } } catch (IOException e) { needsToDownload = true; } } if (needsToDownload) { URL latestJar = new URL(LATEST_JAR); System.out.println("Downloading latest Helios implementation"); FileOutputStream out = new FileOutputStream(IMPL_FILE); HttpURLConnection connection = (HttpURLConnection) latestJar.openConnection(); if (connection.getResponseCode() == 200) { int contentLength = connection.getContentLength(); if (contentLength > 0) { InputStream stream = connection.getInputStream(); byte[] buffer = new byte[1024]; int amnt; AtomicInteger total = new AtomicInteger(); AtomicBoolean stop = new AtomicBoolean(false); Thread progressBar = new Thread() { public void run() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); JLabel label = new JLabel(); label.setText("Downloading latest Helios build"); panel.add(label); GridLayout layout = new GridLayout(); layout.setColumns(1); layout.setRows(3); panel.setLayout(layout); JProgressBar pbar = new JProgressBar(); pbar.setMinimum(0); pbar.setMaximum(100); panel.add(pbar); JTextArea textArea = new JTextArea(1, 3); textArea.setOpaque(false); textArea.setEditable(false); textArea.setText("Downloaded 00.00MB/00.00MB"); panel.add(textArea); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setContentPane(panel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); while (!stop.get()) { SwingUtilities.invokeLater( () -> pbar.setValue((int) (100.0 * total.get() / contentLength))); textArea.setText("Downloaded " + bytesToMeg(total.get()) + "MB/" + bytesToMeg(contentLength) + "MB"); try { Thread.sleep(100); } catch (InterruptedException ignored) { } } frame.dispose(); } }; progressBar.start(); while ((amnt = stream.read(buffer)) != -1) { out.write(buffer, 0, amnt); total.addAndGet(amnt); } stop.set(true); return loadHelios(); } else { throw new IOException("Content-Length set to " + connection.getContentLength()); } } else if (connection.getResponseCode() == 404) { // Most likely bootstrapper is out of date throw new RuntimeException("Bootstrapper out of date!"); } else { throw new IOException(connection.getResponseCode() + ": " + connection.getResponseMessage()); } } return data; }
From source file:Main.java
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event-dispatching thread. */// www .j av a 2 s . c o m private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("ListDataEventDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = new Main(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Don't let the content pane get too small. //(Works if the Java look and feel provides //the window decorations.) newContentPane.setMinimumSize(new Dimension(newContentPane.getPreferredSize().width, 100)); //Display the window. frame.pack(); frame.setVisible(true); }
From source file:ExtendedDnDDemo.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 2s . c o m */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("ExtendedDnDDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = new ExtendedDnDDemo(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
From source file:ProgressMonitorDemo.java
/** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread./*from w w w.ja va 2 s.c o m*/ */ private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("ProgressMonitorDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = new ProgressMonitorDemo(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
From source file:ch.admin.hermes.etl.load.HermesETLApplication.java
/** * erstellt einen Progress Dialog/* www. j a v a 2 s.c om*/ * @return */ private static JFrame createProgressDialog() { JFrame frame = new JFrame("HERMES 5 XML Model nach Fremdsystem/Format"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); progress = new JProgressBar(); progress.setStringPainted(true); //Create and set up the content pane. progress.setOpaque(true); //content panes must be opaque frame.setContentPane(progress); frame.setTitle("Schreibe nach Zielsystem/Format"); //Display the window. frame.pack(); frame.setSize(400, 100); frame.setLocation(100, 100); frame.setVisible(true); return frame; }
From source file:misc.InputVerificationDialogDemo.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 ava 2 s . c o m*/ */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("InputVerificationDialogDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent newContentPane = new InputVerificationDialogDemo(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }