Example usage for javax.swing JFrame setTitle

List of usage examples for javax.swing JFrame setTitle

Introduction

In this page you can find the example usage for javax.swing JFrame setTitle.

Prototype

public void setTitle(String title) 

Source Link

Document

Sets the title for this frame to the specified string.

Usage

From source file:com.moss.bdbadmin.client.ui.BdbAdminClient.java

public static void main(String[] args) throws Exception {

    Thread t = new Thread() {
        public void run() {
            try {
                Magic.initialize();// w  w w  .j  a  v  a2s  . c om
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    };
    t.setPriority(Thread.MIN_PRIORITY);
    t.start();

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

    HttpClient httpClient = new HttpClient();
    BdbClient.init();

    JFrame frame = new JFrame();

    ProxyFactory proxyFactory = VeracityProxyFactory.create();

    BdbAdminClient client = new BdbAdminClient(httpClient, frame, new File("config.xml"), proxyFactory);

    frame.setTitle("Bdb Network Explorer");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(client);
    frame.setSize(1024, 768);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

From source file:junk.gui.HazardSpectrumApplication.java

public static void main(String[] args) {
    HazardSpectrumApplication applet = new HazardSpectrumApplication();
    applet.isStandalone = true;/*from  w w w.  ja  v  a  2 s  . com*/
    JFrame frame = new JFrame();
    //EXIT_ON_CLOSE == 3
    frame.setDefaultCloseOperation(3);
    frame.setTitle("Hazard Spectrum Applet");
    frame.getContentPane().add(applet, BorderLayout.CENTER);
    applet.init();
    applet.start();
    frame.setSize(W, H);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
    frame.setVisible(true);
}

From source file:Main.java

static void createFrameAtLocation(Point p) {
    JFrame frame = new JFrame();
    frame.setTitle("Test frame on two screens");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel(new BorderLayout());
    JTextArea textareaA = new JTextArea(24, 80);
    textareaA.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));
    panel.add(textareaA, BorderLayout.CENTER);
    frame.setLocation(p);//from   www  .j  a  va2  s.c om
    frame.add(panel);
    frame.pack();
    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    frame.setVisible(true);
}

From source file:Main.java

static public void show(Component panel) {
    JFrame frame = new JFrame();
    frame.setTitle("TestForm");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.getContentPane().add(panel);/*w  w w .  j  a  v a2s .c o m*/
    frame.pack();
    frame.show();
}

From source file:Main.java

public static JFrame wrapPanelInFrame(JFrame frame, JPanel panel, String caption, int width, int height) {
    frame.setTitle(caption);
    frame.setSize(width, height);//from w  w w.ja  v  a 2  s .c o m
    frame.add(panel);
    //another way to do this: frame.getContentPane().add(panel, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
    return frame;
}

From source file:ConsoleWindowTest.java

public static void init() {
    JFrame frame = new JFrame();
    frame.setTitle("ConsoleWindow");
    final JTextArea output = new JTextArea();
    output.setEditable(false);/*from  w  w w  . java  2 s . c om*/
    frame.add(new JScrollPane(output));
    frame.setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    frame.setLocation(DEFAULT_LEFT, DEFAULT_TOP);
    frame.setFocusableWindowState(false);
    frame.setVisible(true);

    // define a PrintStream that sends its bytes to the output text area
    PrintStream consoleStream = new PrintStream(new OutputStream() {
        public void write(int b) {
        } // never called

        public void write(byte[] b, int off, int len) {
            output.append(new String(b, off, len));
        }
    });

    // set both System.out and System.err to that stream
    System.setOut(consoleStream);
    System.setErr(consoleStream);
}

From source file:net.rptools.maptool.util.AssetExtractor.java

public static void extract() throws Exception {
    new Thread() {
        @Override//from  w  w w  . j a v a2s  . c o  m
        public void run() {
            JFileChooser chooser = new JFileChooser();
            chooser.setMultiSelectionEnabled(false);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            if (chooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) {
                return;
            }
            File file = chooser.getSelectedFile();
            File newDir = new File(file.getParentFile(),
                    file.getName().substring(0, file.getName().lastIndexOf('.')) + "_images");

            JLabel label = new JLabel("", JLabel.CENTER);
            JFrame frame = new JFrame();
            frame.setTitle("Campaign Image Extractor");
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            frame.setSize(400, 75);
            frame.add(label);
            SwingUtil.centerOnScreen(frame);
            frame.setVisible(true);
            Reader r = null;
            OutputStream out = null;
            PackedFile pakfile = null;
            try {
                newDir.mkdirs();

                label.setText("Loading campaign ...");
                pakfile = new PackedFile(file);

                Set<String> files = pakfile.getPaths();
                XStream xstream = new XStream();
                int count = 0;
                for (String filename : files) {
                    count++;
                    if (filename.indexOf("assets") < 0) {
                        continue;
                    }
                    r = pakfile.getFileAsReader(filename);
                    Asset asset = (Asset) xstream.fromXML(r);
                    IOUtils.closeQuietly(r);

                    File newFile = new File(newDir, asset.getName() + ".jpg");
                    label.setText("Extracting image " + count + " of " + files.size() + ": " + newFile);
                    if (newFile.exists()) {
                        newFile.delete();
                    }
                    newFile.createNewFile();
                    out = new FileOutputStream(newFile);
                    FileUtil.copyWithClose(new ByteArrayInputStream(asset.getImage()), out);
                }
                label.setText("Done.");
            } catch (Exception ioe) {
                MapTool.showInformation("AssetExtractor failure", ioe);
            } finally {
                if (pakfile != null)
                    pakfile.close();
                IOUtils.closeQuietly(r);
                IOUtils.closeQuietly(out);
            }
        }
    }.start();
}

From source file:stratego.neural.net.RandomSampleTest.java

private static void plotDataSet(List<double[]> data) {

    XYSeriesCollection plotData = new XYSeriesCollection();

    for (double[] ds : data) {

        XYSeries series = new XYSeries("Winrate");

        for (int i = 0; i < ds.length; i++) {
            series.add((double) i, ds[i]);
        }//  w w  w. ja  v  a  2  s.c  om

        plotData.addSeries(series);
    }

    String title = "Simulating Random Samples";
    String xAxisLabel = "Matches";
    String yAxisLabel = "Winrate";
    PlotOrientation orientation = PlotOrientation.VERTICAL;
    boolean legend = false; // might wanna set this to true at some point, but research the library
    boolean tooltips = false;
    boolean urls = false;
    JFreeChart chart = ChartFactory.createScatterPlot(title, xAxisLabel, yAxisLabel, plotData, orientation,
            legend, tooltips, urls);

    JPanel panel = new ChartPanel(chart);

    JFrame f = new JFrame();
    f.add(panel);
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.pack();
    f.setTitle("Random test simulation");

    f.setVisible(true);
}

From source file:stratego.neural.net.StrategoNeuralNet.java

private static void plotDataSet(List<NamedDataSet> ArraySetList, String network_name) {

    String plot_title = "Plot " + plotIndex + ": Overfitting on network " + network_name;
    XYSeriesCollection plotData = new XYSeriesCollection();

    for (NamedDataSet ns : ArraySetList) {
        XYSeries series = new XYSeries(ns.getName());
        double[] data = ns.getArray();
        for (int i = 0; i < data.length; i++) {
            series.add((double) i, data[i]);
        }//  ww  w.j  av a  2 s . c o  m

        plotData.addSeries(series);
    }

    String title = plot_title;
    String xAxisLabel = "Epochs";
    String yAxisLabel = "Accuracy";
    PlotOrientation orientation = PlotOrientation.VERTICAL;
    boolean legend = true; // might wanna set this to true at some point, but research the library
    boolean tooltips = false;
    boolean urls = false;
    JFreeChart chart = ChartFactory.createScatterPlot(title, xAxisLabel, yAxisLabel, plotData, orientation,
            legend, tooltips, urls);

    JPanel panel = new ChartPanel(chart);

    JFrame f = new JFrame();
    f.add(panel);
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.pack();
    f.setTitle(plot_title);

    f.setVisible(true);

    plotIndex++; // increase the plotindex
}

From source file:org.deeplearning4j.examples.dataexamples.CSVPlotter.java

/**
 * Generate an xy plot of the datasets provided.
 *//* w w  w .  j av a2 s .c o m*/
private static void plotDataset(ArrayList<DataSet> DataSetList) {

    XYSeriesCollection c = new XYSeriesCollection();

    int dscounter = 1; //use to name the dataseries
    for (DataSet ds : DataSetList) {
        INDArray features = ds.getFeatures();
        INDArray outputs = ds.getLabels();

        int nRows = features.rows();
        XYSeries series = new XYSeries("S" + dscounter);
        for (int i = 0; i < nRows; i++) {
            series.add(features.getDouble(i), outputs.getDouble(i));
        }

        c.addSeries(series);
    }

    String title = "title";
    String xAxisLabel = "xAxisLabel";
    String yAxisLabel = "yAxisLabel";
    PlotOrientation orientation = PlotOrientation.VERTICAL;
    boolean legend = false;
    boolean tooltips = false;
    boolean urls = false;
    JFreeChart chart = ChartFactory.createScatterPlot(title, xAxisLabel, yAxisLabel, c, orientation, legend,
            tooltips, urls);
    JPanel panel = new ChartPanel(chart);

    JFrame f = new JFrame();
    f.add(panel);
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.pack();
    f.setTitle("Training Data");

    f.setVisible(true);
}