List of usage examples for javax.swing JFrame setTitle
public void setTitle(String title)
From source file:SplashScreenTest.java
/** * This method displays a frame with the same image as the splash screen. *//* ww w .j a va 2 s . c om*/ private static void init2() { final Image img = Toolkit.getDefaultToolkit().getImage(splash.getImageURL()); final JFrame splashFrame = new JFrame(); splashFrame.setUndecorated(true); final JPanel splashPanel = new JPanel() { public void paintComponent(Graphics g) { g.drawImage(img, 0, 0, null); } }; final JProgressBar progressBar = new JProgressBar(); progressBar.setStringPainted(true); splashPanel.setLayout(new BorderLayout()); splashPanel.add(progressBar, BorderLayout.SOUTH); splashFrame.add(splashPanel); splashFrame.setBounds(splash.getBounds()); splashFrame.setVisible(true); new SwingWorker<Void, Integer>() { protected Void doInBackground() throws Exception { try { for (int i = 0; i <= 100; i++) { publish(i); Thread.sleep(100); } } catch (InterruptedException e) { } return null; } protected void process(List<Integer> chunks) { for (Integer chunk : chunks) { progressBar.setString("Loading module " + chunk); progressBar.setValue(chunk); splashPanel.repaint(); // because img is loaded asynchronously } } protected void done() { splashFrame.setVisible(false); JFrame frame = new JFrame(); frame.setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("SplashScreenTest"); frame.setVisible(true); } }.execute(); }
From source file:com.javafxpert.neuralnetviz.scenario.PlotUtil.java
/**Plot the training data. Assume 2d input, classification output * @param features Training data features * @param labels Training data labels (one-hot representation) * @param backgroundIn sets of x,y points in input space, plotted in the background * @param backgroundOut results of network evaluation at points in x,y points in space * @param nDivisions Number of points (per axis, for the backgroundIn/backgroundOut arrays) */// ww w. j av a 2 s . co m public static void plotTrainingData(INDArray features, INDArray labels, INDArray backgroundIn, INDArray backgroundOut, int nDivisions) { double[] mins = backgroundIn.min(0).data().asDouble(); double[] maxs = backgroundIn.max(0).data().asDouble(); XYZDataset backgroundData = createBackgroundData(backgroundIn, backgroundOut); JPanel panel = new ChartPanel( createChart(backgroundData, mins, maxs, nDivisions, createDataSetTrain(features, labels))); JFrame f = new JFrame(); f.add(panel); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.pack(); f.setTitle("Training Data"); f.setVisible(true); }
From source file:com.javafxpert.neuralnetviz.scenario.PlotUtil.java
/**Plot the training data. Assume 2d input, classification output * @param features Training data features * @param labels Training data labels (one-hot representation) * @param predicted Network predictions, for the test points * @param backgroundIn sets of x,y points in input space, plotted in the background * @param backgroundOut results of network evaluation at points in x,y points in space * @param nDivisions Number of points (per axis, for the backgroundIn/backgroundOut arrays) */// w w w .j a v a2 s . c om public static void plotTestData(INDArray features, INDArray labels, INDArray predicted, INDArray backgroundIn, INDArray backgroundOut, int nDivisions) { double[] mins = backgroundIn.min(0).data().asDouble(); double[] maxs = backgroundIn.max(0).data().asDouble(); XYZDataset backgroundData = createBackgroundData(backgroundIn, backgroundOut); JPanel panel = new ChartPanel(createChart(backgroundData, mins, maxs, nDivisions, createDataSetTest(features, labels, predicted))); JFrame f = new JFrame(); f.add(panel); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.pack(); f.setTitle("Test Data"); f.setVisible(true); }
From source file:stratego.neural.net.NeuralNetTest.java
private static void plotDataSet(List<NamedDataSet> ArraySetList) { 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 ava 2 s.co m*/ plotData.addSeries(series); } String title = "Overfitting Data"; 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("Overfitting data"); f.setVisible(true); }
From source file:stratego.neural.net.SimulatedAnnealing.java
private static void plotDataSet(List<NamedDataSet> ArraySetList, String name, String xAxis, String yAxis, boolean legend) throws IOException { String plot_title = name;/*from www. j a v a2 s.com*/ 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]); } plotData.addSeries(series); } String title = plot_title; String xAxisLabel = xAxis; String yAxisLabel = yAxis; 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); // ChartUtilities.saveChartAsJPEG(new File("src/Graphs/test_graph_1.JPEG"),chart,1280,1024); }
From source file:ch.admin.hermes.etl.load.HermesETLApplication.java
/** * erstellt einen Progress Dialog/*from ww w .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:bdi4jade.examples.BDI4JADEExamplesApp.java
/** * Creates and shows a GUI whose content pane is an * {@link BDI4JADEExamplesPanel}./*ww w . j a v a 2 s . c o m*/ */ public void createAndShowGUI() { final JFrame frame = new JFrame(); frame.setTitle("BDI4JADE Examples"); frame.setContentPane(agentTestPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { frame.setVisible(true); } }); }
From source file:graphml.GraphML.java
public GraphML(String filename) throws ParserConfigurationException, SAXException, IOException { GraphMLReader<UndirectedGraph<node, edge>, node, edge> gmlr = new GraphMLReader<UndirectedGraph<node, edge>, node, edge>( new VertexFactory(), new EdgeFactory()); final UndirectedGraph<node, edge> graph = new UndirectedSparseMultigraph<node, edge>(); // final DirectedGraph<node, edge> graph = new DirectedSparseMultigraph<node, edge>(); gmlr.load(filename, graph); //Here we read in our graph. filename is our .graphml file, and graph is where we // will store our graph. BidiMap<node, String> vertex_ids = gmlr.getVertexIDs(); //The vertexIDs are stored in a BidiMap. Map<String, GraphMLMetadata<node>> vertex_color = gmlr.getVertexMetadata(); //Our vertex Metadata is stored in a map. Map<String, GraphMLMetadata<edge>> edge_meta = gmlr.getEdgeMetadata(); // Our edge Metadata is stored in a map. System.out.println(graph.getEdgeCount()); // Here we iterate through our vertices, n, and we set the value and the color of our nodes from the data we have // in the vertex_ids map and vertex_color map. for (node n : graph.getVertices()) { n.setValue(vertex_ids.get(n)); //Set the value of the node to the vertex_id which was read in from the GraphML Reader. n.setColor(vertex_color.get("d0").transformer.transform(n)); // Set the color, which we get from the Map, vertex_color. //Let's print out the data so we can get a good understanding of what we've got going on. System.out.println("ID: " + n.getID() + ", Value: " + n.getValue() + ", Color: " + n.getColor()); }// w w w.j a v a2s . com // Just as we added the vertices to the graph, we add the edges as well. for (edge e : graph.getEdges()) { e.setValue(edge_meta.get("d1").transformer.transform(e)); //Set the edge's value. System.out.println("Edge ID: " + e.getID()); } TreeBuilder treeBuilder = new TreeBuilder(graph); // create a simple graph for the demo: //First we make a VisualizationViewer, of type node, edge. We give it our Layout, and the Layout takes a graph in it's constructor. //VisualizationViewer<node, edge> vv = new VisualizationViewer<node, edge>(new FRLayout<node, edge>(graph)); VisualizationViewer<node, edge> vv = new VisualizationViewer<node, edge>( new TreeLayout<node, edge>(treeBuilder.getTree())); //Next we set some rendering properties. First we want to color the vertices, so we provide our own vertexPainter. vv.getRenderContext().setVertexFillPaintTransformer(new vertexPainter()); //Then we want to provide labels to our nodes, Jung provides a nice function which makes the graph use a vertex's ToString function //as it's way of labelling. We do the same for the edge. Look at the edge and node classes for their ToString function. vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<node>()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<edge>()); // Next we do some Java stuff, we create a frame to hold the graph final JFrame frame = new JFrame(); frame.setTitle("GraphMLReader for Trees - Reading in Attributes"); //Set the title of our window. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Give a close operation. //Here we get the contentPane of our frame and add our a VisualizationViewer, vv. frame.getContentPane().add(vv); //Finally, we pack it to make sure it is pretty, and set the frame visible. Voila. frame.pack(); frame.setVisible(true); }
From source file:hr.fer.zemris.vhdllab.platform.support.VhdllabLifecycleAdvisor.java
private void showUserCredentials() { ApplicationWindow window = getApplication().getActiveWindow(); JFrame frame = window.getControl(); String user = ApplicationContextHolder.getContext().getUserId(); frame.setTitle(frame.getTitle() + ", " + user); window.getStatusBar().setMessage("Logged in as " + user); }
From source file:TradeMonitorGui.java
private XYPlot createChartFrame(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart("Average Stock Price over 1 minute", "Time", "Price in USD", dataset, true, true, false); XYPlot plot = chart.getXYPlot();//from w w w . j ava 2s .c o m plot.setBackgroundPaint(new Color(245, 245, 245)); plot.setDomainGridlinePaint(Color.BLACK); plot.setRangeGridlinePaint(Color.BLACK); final JFrame frame = new JFrame(); frame.setBackground(Color.WHITE); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setTitle("Trade Monitor"); frame.setBounds(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT); frame.setLayout(new BorderLayout()); frame.add(new ChartPanel(chart)); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { avgPrices.removeEntryListener(listenerId); } }); frame.setVisible(true); return plot; }