public static void main(String[] args) { ArrayList<Pattern> patterns = new ArrayList<Pattern>(); ArrayList<Cut> cuts; ArrayList<Garment> garments; patterns.add(new Pattern(2, 2, 1, "Tie")); patterns.add(new Pattern(2, 6, 4, "Skirt")); patterns.add(new Pattern(4, 2, 3, "Blouse")); patterns.add(new Pattern(5, 3, 5, "Dress")); int width = 30; int height = 15; ClothCutter cutter = new ClothCutter(width, height, patterns); System.out.println("Optimized value: " + cutter.optimize()); cuts = cutter.getCuts(); garments = cutter.getGarments(); ClothPanel panel = new ClothPanel(width, height); JFrame frame = new JFrame("A luxurious bolt of fabric"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); sleep(1000); for (int i = 0; i < cuts.size(); i++) { panel.drawCut(cuts.get(i)); sleep(100); } for (int i = 0; i < garments.size(); i++) { System.out.println(garments.get(i)); panel.drawGarment(garments.get(i)); sleep(100); } }
public Processing(Box root) { super(null); Log.log("startup.processing", " processing plugin is starting up "); frame = new JFrame("Field/Processing"); __applet = new FieldProcessingApplet( sizeX, sizeY, queue, this, s -> { if (getLastErrorOutput() != null) getLastErrorOutput().accept(new Pair<>(-1, s)); }); __applet.init(); __applet.loop(); frame.add(__applet, BorderLayout.CENTER); frame.setSize(sizeX, sizeY); frame.setVisible(true); frame.validate(); applet = new FieldProcessingAppletDelgate(__applet); this.properties.put(P, applet); Log.log("startup.processing", " searching for boxes that need processing support "); Log.log("startup.processing", " processing plugin has finished starting up "); }
public void launchTrajectoryRenderer() { Visualizer tv = this.getTrajectoryRenderLayerBase(); List<EpisodeAnalysis> trajectories = EpisodeAnalysis.parseFilesIntoEAList(this.expertDir, this.domain, this.sp); TrajectoryRenderer tr = new TrajectoryRenderer( trajectories, GridWorldDomain.CLASSAGENT, GridWorldDomain.ATTX, GridWorldDomain.ATTY, new double[] {0, 30, .5}, new double[] {0, 30, .5}, 3.f, 10.f); tv.addRenderLayer(tr); tv.updateState(trajectories.get(0).getState(0)); JFrame frame = new JFrame(); frame.setPreferredSize(new Dimension(800, 800)); frame.getContentPane().add(tv); frame.pack(); frame.setVisible(true); }
/** * Init JWhiteBoard interface * * @throws Exception */ public void go() throws Exception { if (!noChannel && !useState) channel.connect(groupName); mainFrame = new JFrame(); mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); drawPanel = new DrawPanel(useState); drawPanel.setBackground(backgroundColor); subPanel = new JPanel(); mainFrame.getContentPane().add("Center", drawPanel); clearButton = new JButton("Clean"); clearButton.setFont(defaultFont); clearButton.addActionListener(this); leaveButton = new JButton("Exit"); leaveButton.setFont(defaultFont); leaveButton.addActionListener(this); subPanel.add("South", clearButton); subPanel.add("South", leaveButton); mainFrame.getContentPane().add("South", subPanel); mainFrame.setBackground(backgroundColor); clearButton.setForeground(Color.blue); leaveButton.setForeground(Color.blue); mainFrame.pack(); mainFrame.setLocation(15, 25); mainFrame.setBounds(new Rectangle(250, 250)); if (!noChannel && useState) { channel.connect(groupName, null, stateTimeout); } mainFrame.setVisible(true); }
/** Simple test program. */ public static void main(String[] args) { final JFrame frame = new JFrame("Testing AddPersonDialog"); JButton button = new JButton("Click me"); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { FamilyTree tree = new FamilyTree(); AddPersonDialog dialog = new AddPersonDialog(frame, tree); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.setVisible(true); Person newPerson = dialog.getPerson(); if (newPerson != null) { tree.addPerson(newPerson); PrettyPrinter pretty = new PrettyPrinter(new PrintWriter(System.out, true)); pretty.dump(tree); } } }); frame.getContentPane().add(button); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(1); } }); frame.pack(); frame.setVisible(true); }
public void openCaptureWindow() { if (framenr - lastcapture_framenr < number_of_frames_before_cwopen) { return; } // Capture Window cw.setVisible(true); cw.toFront(); // Timer for closing the capturewindow TimerTask task = new TimerTask() { @Override public void run() { EventQueue.invokeLater( new Runnable() { public void run() { System.out.println("Closing cw..."); cw.setVisible(false); cwText.setText(""); // Empty text in case there is a text } }); } }; cwTimer = new Timer(); cwTimer.schedule(task, number_of_second_capturewindow * 1000); }
public void create() { JFrame frame = new JFrame(); frame.getContentPane().add(new JScrollPane(jgraph)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
public TabSpawnable spawn() { JFrame f = new JFrame(); f.getContentPane().setLayout(new BorderLayout()); f.setTitle(_title); TabSpawnable newPanel = (TabSpawnable) clone(); if (newPanel == null) return null; // failed to clone newPanel.setTitle(_title); if (newPanel instanceof TabToDoTarget) { TabToDoTarget me = (TabToDoTarget) this; TabToDoTarget it = (TabToDoTarget) newPanel; it.setTarget(me.getTarget()); } else if (newPanel instanceof TabModelTarget) { TabModelTarget me = (TabModelTarget) this; TabModelTarget it = (TabModelTarget) newPanel; it.setTarget(me.getTarget()); } f.getContentPane().add(newPanel, BorderLayout.CENTER); Rectangle bounds = getBounds(); bounds.height += OVERLAPP * 2; f.setBounds(bounds); Point loc = new Point(0, 0); SwingUtilities.convertPointToScreen(loc, this); loc.y -= OVERLAPP; f.setLocation(loc); f.setVisible(true); if (_tear && (getParent() instanceof JTabbedPane)) ((JTabbedPane) getParent()).remove(this); return newPanel; }
private void _displayRespStrInFrame() { final JFrame frame = new JFrame("Google Static Map - Error"); GUIUtils.setAppIcon(frame, "69.png"); // frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); JTextArea response = new JTextArea(_respStr, 25, 80); response.addMouseListener( new MouseListener() { public void mouseClicked(MouseEvent e) {} public void mousePressed(MouseEvent e) { /*frame.dispose();*/ } public void mouseReleased(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} }); frame.setContentPane(new JScrollPane(response)); frame.pack(); GUIUtils.centerOnScreen(frame); frame.setVisible(true); }
public static void main(String[] args) { final JPopupMenu menu = new JPopupMenu(); menu.setLayout(new GridLayout(0, 3, 5, 5)); final MenuedButton button = new MenuedButton("Icons", menu); for (int i = 0; i < 9; i++) { // replace "print.gif" with your own image final JLabel label = new JLabel("" + i); // new ImageIcon("resources/images/print.gif") ); label.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { button.getMainButton().setIcon(label.getIcon()); menu.setVisible(false); } }); menu.add(label); } JFrame frame = new JFrame("Button Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new JLabel("Click Arrow Button To Show Popup"), BorderLayout.NORTH); frame.getContentPane().add(button, BorderLayout.CENTER); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
/** Builds a BarChartGenerator and attaches it as a display in a MASON simulation. */ public static BarChartGenerator buildBarChartGenerator(GUIState state, String title) { BarChartGenerator chart = buildBarChartGenerator(title); JFrame frame = chart.createFrame(); frame.setVisible(true); frame.pack(); state.controller.registerFrame(frame); return chart; }
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(500, 500); frame.add(new GMEDefaultsPanel()); frame.setVisible(true); }
/** * Overrides java.awt.Container.setVisible() so that we are sure that the Frame's size is set * before displaying. */ public void setVisible(boolean state) { if (state) { Dimension bounds = getToolkit().getScreenSize(); setLocation((bounds.width - getSize().width) / 2, (bounds.height - getSize().height) / 2); } super.setVisible(state); }
public static void main(String args[]) { JFrame frame = new CopyFileToTable(); frame.setTitle("CopyFileToTable"); frame.setSize(700, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); }
public static void main(String[] args) { Chart shc = new Chart("C:/TEMP/table.csv"); JFrame frame = new JFrame("Stock History Chart for " + shc.getSymbol()); frame.getContentPane().add(shc, BorderLayout.CENTER); frame.setSize(640, 480); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public static void main(String[] args) { JFrame frame = new JFrame("AVLTreeAnimation"); JApplet applet = new AVLTreeAnimation(); frame.add(applet); frame.setSize(500, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); }
/** Builds a ScatterPlotGenerator and attaches it as a display in a MASON simulation. */ public static ScatterPlotGenerator buildScatterPlotGenerator( GUIState state, String title, String rangeAxisLabel, String domainAxisLabel) { ScatterPlotGenerator chart = buildScatterPlotGenerator(title, rangeAxisLabel, domainAxisLabel); JFrame frame = chart.createFrame(); frame.setVisible(true); frame.pack(); state.controller.registerFrame(frame); return chart; }
/** Builds a TimeSeriesChartGenerator and attaches it as a display in a MASON simulation. */ public static TimeSeriesChartGenerator buildTimeSeriesChartGenerator( GUIState state, String title, String domainAxisLabel) { TimeSeriesChartGenerator chart = buildTimeSeriesChartGenerator(title, domainAxisLabel); JFrame frame = chart.createFrame(); frame.setVisible(true); frame.pack(); state.controller.registerFrame(frame); return chart; }
public static void main(String[] argumentenRij) { JFrame frame = new Vb1300_Loop_Gaat_Niet(); frame.setSize(800, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Vb1300_Loop_Gaat_Niet"); // naam aanpassen als je Paneel van naam wijzigt !!! Paneel paneel = new Paneel(); frame.setContentPane(paneel); frame.setVisible(true); }
/** * Displays a frame with the broken line, tha consists of points from the * listOfPointsToBeConnected. */ void draw() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(new MyPanel()); frame.setSize(800, 600); frame.setVisible(true); }
/** Leave Group and close JWhiteBoard */ public void stop() { if (!noChannel) { try { channel.close(); } catch (Exception ex) { System.err.println(ex); } } mainFrame.setVisible(false); mainFrame.dispose(); }
private void addButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addButtonActionPerformed if (targetObjective == null) { JOptionPane.showMessageDialog( null, "Warning: All fields must be defined.", "Warning", JOptionPane.WARNING_MESSAGE); return; } psdre.addObjective(targetObjective); frame.setVisible(false); frame.dispose(); } // GEN-LAST:event_addButtonActionPerformed
public static void main(String[] argumentenRij) { JFrame frame = new Vb0800_Algoritmen_Allerlei(); frame.setSize(275, 700); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Vb0800_Algoritmen_Allerlei"); // naam aanpassen als je Paneel van naam wijzigt !!! Paneel paneel = new Paneel(); frame.setContentPane(paneel); frame.setAlwaysOnTop(true); frame.setVisible(true); }
@Override public void setVisible(boolean b) { if (this.treeViewNode == null) { dispose(); return; } super.setVisible(b); if (b) { run(); } }
public ArcViewer() { JFrame frame = new JFrame("ArcViewer v.0.9"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add("Center", this); frame.setSize(900, 600); frame.setVisible(true); init(); }
/** * You can ignore this method. This method gets called by the subclass's constructor when it has * finished initializing, but that call is already written in <code>MyGame.java</code>. */ protected void ready() { if (applet) { add(canvas); } else { frame.add(canvas); frame.pack(); frame.setLocationRelativeTo(null); frame.setResizable(false); frame.setVisible(true); } }
public void add() { mainFrame.setDefaultCloseOperation(mainFrame.EXIT_ON_CLOSE); statusPanel.add(jl); menuBar.add(menu); menu.add(menuItem); menuItem.addActionListener(this); container.setLayout(new BorderLayout()); container.add(menuBar, BorderLayout.NORTH); container.add(jl, BorderLayout.SOUTH); mainFrame.pack(); mainFrame.setVisible(true); }
/** * Create the GUI and show it. For thread safety, this method should be invoked from the event * dispatch thread. */ private static void showGUI() { // Create and set up the window. JFrame frame = new JFrame("CaliKing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Add contents to the window. frame.add(new MakeReservation()); // Display the window. frame.pack(); frame.setVisible(true); }
public void go() { frame = new JFrame("Quiz Card Player"); JPanel mainPanel = new JPanel(); Font bigFont = new Font("sanserif", Font.BOLD, 24); display = new JTextArea(10, 20); display.setFont(bigFont); display.setLineWrap(true); display.setEditable(false); JScrollPane qScroller = new JScrollPane(display); qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); nextButton = new JButton("Show Questions"); nextButton.addActionListener(new NextCardListener()); mainPanel.add(qScroller); mainPanel.add(nextButton); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenuItem loadMenuItem = new JMenuItem("Load Card Set"); loadMenuItem.addActionListener(new OpenMenuListener()); fileMenu.add(loadMenuItem); menuBar.add(fileMenu); frame.setJMenuBar(menuBar); frame.getContentPane().add(BorderLayout.CENTER, mainPanel); frame.setSize(640, 500); frame.setVisible(true); }
public void go() { // build gui frame = new JFrame("Quiz Card Buider"); JPanel mainPanel = new JPanel(); Font bigFont = new Font("sanserif", Font.BOLD, 24); question = new JTextArea(6, 20); question.setLineWrap(true); question.setWrapStyleWord(true); question.setFont(bigFont); JScrollPane qScroller = new JScrollPane(question); qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); answer = new JTextArea(6, 20); answer.setLineWrap(true); answer.setWrapStyleWord(true); answer.setFont(bigFont); JScrollPane aScroller = new JScrollPane(question); aScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); aScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); JButton nextButton = new JButton("Next Card"); cardList = new ArrayList<QuizCard>(); JLabel qLabel = new JLabel("Question"); JLabel aLabel = new JLabel("Answer"); mainPanel.add(qLabel); mainPanel.add(qScroller); mainPanel.add(aLabel); mainPanel.add(aScroller); mainPanel.add(nextButton); nextButton.addActionListener(new NextCardListener()); JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenuItem newMenuItem = new JMenuItem("New"); JMenuItem saveMenuItem = new JMenuItem("Save"); newMenuItem.addActionListener(new NewMenuListener()); saveMenuItem.addActionListener(new SaveMenuListener()); fileMenu.add(newMenuItem); fileMenu.add(saveMenuItem); menuBar.add(fileMenu); frame.setJMenuBar(menuBar); frame.getContentPane().add(BorderLayout.CENTER, mainPanel); frame.setSize(500, 600); frame.setVisible(true); // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }