public void loadClassListScreen(String sessionKey, String username) { RequestMessage<Void> req = new RequestMessage<>(); req.setAction("listClosedClasses"); req.setSessionKey(sessionKey); MessageBroker broker = MainController.get().getMessageBroker(); CompletableFuture<ResponseMessage<List<Claass>>> resFut; resFut = broker.sendMessageAsync(req); resFut.whenComplete( (res, e) -> { JFrame frame = MainController.get().getMainWindow().getFrame(); if (e != null) { JOptionPane.showMessageDialog( frame, "Houve um erro ao tentar carregar lista", "Erro", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); return; } StudentClassListPanel panel = new StudentClassListPanel(sessionKey, res.getValue(), username); EventQueue.invokeLater( () -> { frame.setContentPane(panel); frame.revalidate(); }); }); }
void setupUI(LocalDisplay[] dpys) throws RemoteException, VisADException { JFrame jframe = new JFrame(getFrameTitle0() + getClientServerTitle()); jframe.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); jframe.setContentPane((JPanel) dpys[0].getComponent()); jframe.pack(); jframe.setVisible(true); if (!uneven) { ScalarMap map1contour = (ScalarMap) dpys[0].getMapVector().lastElement(); ContourWidget cw = new ContourWidget(map1contour); JPanel big_panel = new JPanel(); big_panel.setLayout(new BorderLayout()); big_panel.add("Center", cw); JFrame jframe2 = new JFrame(getFrameTitle1()); jframe2.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); jframe2.setContentPane(big_panel); jframe2.pack(); jframe2.setVisible(true); } }
public static void main(String[] args) { JFrame frame = new JFrame("Regler"); frame.setContentPane(new Regler().panel1); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
public static void main(String[] arg) { // init table with Random Random alea = new Random(System.currentTimeMillis()); for (int i = 0; i < table.length; i++) { table[i] = alea.nextInt(10); } System.out.println(Arrays.toString(table)); // pick median values 3 by 3 using Arrays.sort for (int i = 1; (i < table.length - 1); i++) { int[] sort3 = {table[i - 1], table[i], table[i + 1]}; Arrays.sort(sort3); median[i] = sort3[1]; System.out.printf("%d %d %d : %d\n", table[i - 1], table[i], table[i + 1], median[i]); } System.out.println(Arrays.toString(median)); // create Frame + Panel + Graphics JFrame cadre = new JFrame(); JPanel ardoise = new Graph(); cadre.setVisible(true); cadre.setContentPane(ardoise); cadre.pack(); cadre.setLocation(100, 100); }
public void setUpGui() { m1 = new MyDrawPanel(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(m1); f.setBounds(30, 30, 300, 300); f.setVisible(true); } // quit meth
public PassWord() { flogin = new JFrame(); panel = new JPanel(); panel.setPreferredSize(new Dimension(400, 300)); panel.setOpaque(false); // 设置透明 flogin.setResizable(false); randomphoto = new random(); ImageIcon titleIcon = new ImageIcon(getClass().getResource("/image/1.jpg")); // 获取图片 randomno = new JLabel(new ImageIcon(randomphoto.creatImage())); ImagePanel jDialogImage = new ImagePanel("/image/2.jpg"); flogin.setContentPane(jDialogImage); // 设置背景图片 jDialogImage.setBounds(0, 0, flogin.getWidth(), flogin.getHeight()); flogin.setIconImage(titleIcon.getImage()); // 设置图标 initframe(); contentPane = flogin.getContentPane(); layout1 = new SpringLayout(); layout2 = new SpringLayout(); add(); contentPane.setLayout(layout1); signIn.addActionListener(this); reset.addActionListener(this); flogin.setBounds(400, 120, 400, 300); flogin.getRootPane().setDefaultButton(signIn); // 设置响应回车键 flogin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); flogin.setVisible(true); contentPane.add(panel); }
public void actionPerformed(ActionEvent e) { JFrame mainFrame = MainFrame.getMain(); mainFrame.setContentPane(new EmployeeHomePanel(employee)); mainFrame.setBounds(mainFrame.getContentPane().getBounds()); mainFrame.setVisible(true); mainFrame.repaint(); }
private static void createAndShowGUI(String firstColumnName, List<String> statNames) { try { String lookAndFeel = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(lookAndFeel); JFrame.setDefaultLookAndFeelDecorated(true); } catch (SOAPFaultException sfe) { printSoapFaultException(sfe); } catch (Exception e) { e.printStackTrace(); } JFrame frame = new JFrame("VITop"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String[] columnNamesArray = new String[statNames.size() + 1]; columnNamesArray[0] = firstColumnName; for (int i = 0; i < statNames.size(); i++) { columnNamesArray[i + 1] = statNames.get(i); } statsTable = new StatsTable(columnNamesArray); statsTable.setOpaque(true); frame.setContentPane(statsTable); frame.pack(); frame.setVisible(true); }
/** * For testing purposes only * * @param args (ignored) */ public static void main(String[] args) { JFrame frame = new JFrame("Cost Test"); Module m = AELMTest.populateModule(); CostPanel panel = new CostPanel(m); frame.setContentPane(panel); frame.setVisible(true); }
public static void main(String[] args) { JFrame f = new JFrame("Test"); f.setContentPane(new AddWMSLayerPanel()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setVisible(true); }
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 IssueTrackerAddIssue(boolean editing, String hash) { frame = new JFrame(editing ? "Issue Editor" : "Issue Logger"); frame.setContentPane(content); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setMinimumSize(new Dimension(900, 400)); frame.setVisible(true); frame.pack(); cancelButton.addActionListener((a) -> frame.dispose()); addButton.addActionListener((a) -> onAdd()); if (editing) { addButton.setText("Edit"); IssueInfo info = IssueTrackerMain.instance.issues.get(hash); textFieldTitle.setText(info.title); descriptionTextArea.setText(info.description); comboBoxPriority.setSelectedItem(info.priority); this.isEditing = true; this.hash = hash; } }
public static void main(String[] args) { JFrame frame = new JFrame("Deque"); frame.setContentPane(new DequeForm().mainPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
/** * Create the GUI and show it. For thread safety, this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { // Create and set up the window. JFrame frame = new JFrame("Automated File Mover"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { try { FileOutputStream f_out = new FileOutputStream(LOG_DIRECTORY + "save.data"); // Write object with ObjectOutputStream ObjectOutputStream obj_out = new ObjectOutputStream(f_out); // Write object out to disk obj_out.writeObject(directoryList); obj_out.writeObject(ERROR_LOG_NAME); obj_out.writeObject(MOVE_LOG_NAME); obj_out.flush(); obj_out.close(); printer.printError(LOG_DIRECTORY); } catch (IOException x) { printer.printError(x.toString()); } } }); // Create and set up the content pane. JComponent newContentPane = new fileBackupProgram(frame); newContentPane.setOpaque(true); // content panes must be opaque frame.setContentPane(newContentPane); // Display the window. frame.pack(); frame.setVisible(true); }
void makeFrame() { JPanel p = new JPanel(); p.setBackground(Color.blue); p.setLayout(new BorderLayout(0, 0)); p.setBorder(new EmptyBorder(0, GAP, GAP, GAP)); days.setFont(BIG); days.setForeground(COLOR); p.add(days, "North"); left.setFont(NORM); left.setForeground(COLOR); p.add(left, "South"); JFrame f = new JFrame("Sayaç"); // a window f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setContentPane(p); setDate(); f.pack(); // minimal size f.setVisible(true); // show f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { stop(); } }); }
public static void main(String[] args) { StringBuffer result = new StringBuffer("<html><body><h1>Fibonacci Sequence</h1><ol>"); long f1 = 0; long f2 = 1; for (int i = 0; i < 50; i++) { result.append("<li>"); result.append(f1); long temp = f2; f2 = f1 + f2; f1 = temp; } result.append("</ol></body></html>"); JEditorPane jep = new JEditorPane("text/html", result.toString()); jep.setEditable(false); // new FibonocciRectangles().execute(); JScrollPane scrollPane = new JScrollPane(jep); JFrame f = new JFrame("Fibonacci Sequence"); f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); f.setContentPane(scrollPane); f.setSize(512, 342); EventQueue.invokeLater(new FrameShower(f)); }
/** @param args */ public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame frame = new JFrame("ZooInspector"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ZooInspectorPanel zooInspectorPanel = new ZooInspectorPanel(new ZooInspectorManagerImpl()); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { super.windowClosed(e); zooInspectorPanel.disconnect(true); } }); frame.setContentPane(zooInspectorPanel); frame.setSize(1024, 768); frame.setVisible(true); } catch (Exception e) { LoggerFactory.getLogger().error("Error occurred loading ZooInspector", e); JOptionPane.showMessageDialog( null, "ZooInspector failed to start: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(500, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new DocumentListenerTest()); frame.setVisible(true); }
private void start() { frame = new JFrame("Pong"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); panel = new JPanel() { public Dimension getPreferredSize() { return new Dimension(W, H); } public void paint(Graphics g) { for (Brick b : bricks) { b.paint(g); } ball.paint(g); paddle.paint(g); } }; frame.setContentPane(panel); frame.pack(); frame.setVisible(true); while (true) { try { tick(); frame.repaint(); Thread.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } } }
/** Display the picture in a window on the screen. */ public void show() { // create the GUI for viewing the image if needed if (frame == null) { frame = new JFrame(); JMenuBar menuBar = new JMenuBar(); JMenu menu = new JMenu("File"); menuBar.add(menu); JMenuItem menuItem1 = new JMenuItem(" Save... "); menuItem1.addActionListener(this); menuItem1.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); menu.add(menuItem1); frame.setJMenuBar(menuBar); frame.setContentPane(getJLabel()); // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setTitle(filename); frame.setResizable(false); frame.pack(); frame.setVisible(true); } // draw frame.repaint(); }
/** GUIコンポーネントを初期化する。 */ public void initComponent() { frame = new JFrame(ClientContext.getFrameTitle(title)); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { stop(); } }); JPanel contentPane = createBrowsePane(); contentPane.setBorder(BorderFactory.createEmptyBorder(12, 12, 11, 11)); contentPane.setOpaque(true); frame.setContentPane(contentPane); frame.pack(); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int n = ClientContext.isMac() ? 3 : 2; int x = (screen.width - frame.getPreferredSize().width) / 2; int y = (screen.height - frame.getPreferredSize().height) / n; frame.setLocation(x, y); blockGlass = new BlockGlass(); frame.setGlassPane(blockGlass); frame.setVisible(true); }
public static void main(final String[] args) { JFrame frame = new JFrame("Credit calculator"); frame.setContentPane(new HypothecCalculator().mainPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
public void guiErstellen() { ml = new MeinZeichenPanel(); f.setContentPane(ml); f.setBounds(30, 30, 300, 300); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public static void main(String[] args) { JFrame frame = new JFrame("MainForm"); frame.setContentPane(new MainForm().panel1); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
void printButton_actionPerformed(ActionEvent e) { DetailSaleDocVO vo = (DetailSaleDocVO) headerFormPanel.getVOModel().getValueObject(); HashMap params = new HashMap(); params.put("COMPANY_CODE", vo.getCompanyCodeSys01DOC01()); params.put("DOC_TYPE", vo.getDocTypeDOC01()); params.put("DOC_YEAR", vo.getDocYearDOC01()); params.put("DOC_NUMBER", vo.getDocNumberDOC01()); HashMap map = new HashMap(); map.put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01DOC01()); map.put(ApplicationConsts.FUNCTION_CODE_SYS06, headerFormPanel.getFunctionId()); map.put(ApplicationConsts.EXPORT_PARAMS, params); Response res = ClientUtils.getData("getJasperReport", map); if (!res.isError()) { JasperPrint print = (JasperPrint) ((VOResponse) res).getVo(); JRViewer viewer = new JRViewer(print); JFrame frame = new JFrame(); frame.setSize(MDIFrame.getInstance().getSize()); frame.setContentPane(viewer); frame.setTitle(this.getTitle()); frame.setIconImage(MDIFrame.getInstance().getIconImage()); frame.setVisible(true); } else JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("print document"), JOptionPane.ERROR_MESSAGE); }
/** @param args */ public static void main(String[] args) { JFrame f = new JFrame("Test PCarte"); f.setSize(800, 600); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.setLayout(new FlowLayout()); // au lieu de BorderLayout par défaut f.getContentPane().setBackground(new Color(143, 143, 195)); PTasDeCartes pt = new PTasDeCartes(new CTasDeCartes("tas", new CUsine())); PCarte pc1 = new PCarte("1D"); pt.empiler(pc1); PCarte pc2 = new PCarte("8S"); pt.empiler(pc2); PCarte pc3 = new PCarte("KH"); pt.empiler(pc3); PCarte pc4 = new PCarte("3C"); pt.empiler(pc4); // pt.depiler(pc1); // f.getContentPane().add(pt); f.setContentPane(pt); // f.pack(); // dimensionner le cadre f.setLocation(200, 100); // le positionner f.setVisible(true); // et le rendre visible }
public static void panelInit() { JFrame frame = new JFrame("Test"); frame.setContentPane(new Test().mainPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
// Initialize all the GUI components and display the frame private static void initGUI() { // Set up the status bar statusField = new JLabel(); statusField.setText(statusMessages[DISCONNECTED]); statusColor = new JTextField(1); statusColor.setBackground(Color.red); statusColor.setEditable(false); statusBar = new JPanel(new BorderLayout()); statusBar.add(statusColor, BorderLayout.WEST); statusBar.add(statusField, BorderLayout.CENTER); // Set up the options pane JPanel optionsPane = initOptionsPane(); // Set up the chat pane JPanel chatPane = new JPanel(new BorderLayout()); chatText = new JTextArea(10, 20); chatText.setLineWrap(true); chatText.setEditable(false); chatText.setForeground(Color.blue); JScrollPane chatTextPane = new JScrollPane( chatText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); chatLine = new JTextField(); chatLine.setEnabled(false); chatLine.addActionListener( new ActionAdapter() { public void actionPerformed(ActionEvent e) { String s = chatLine.getText(); if (!s.equals("")) { appendToChatBox("OUTGOING: " + s + "\n"); chatLine.selectAll(); // Send the string sendString(s); } } }); chatPane.add(chatLine, BorderLayout.SOUTH); chatPane.add(chatTextPane, BorderLayout.CENTER); chatPane.setPreferredSize(new Dimension(200, 200)); // Set up the main pane JPanel mainPane = new JPanel(new BorderLayout()); mainPane.add(statusBar, BorderLayout.SOUTH); mainPane.add(optionsPane, BorderLayout.WEST); mainPane.add(chatPane, BorderLayout.CENTER); // Set up the main frame mainFrame = new JFrame("Simple TCP Chat"); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.setContentPane(mainPane); mainFrame.setSize(mainFrame.getPreferredSize()); mainFrame.setLocation(200, 200); mainFrame.pack(); mainFrame.setVisible(true); }
public void showMainMenu() { frame = new JFrame("JMSUtilForm"); frame.setContentPane(new MainMenu().panel1); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setSize(800, 600); frame.setVisible(true); }
/** * Main method. Creates a window. * * @param args the command line arguments */ public static void main(String[] args) { JFrame frame = new JFrame("Tic Tac Toe"); frame.setSize(400, 400); frame.setLocation(100, 50); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Panel()); frame.setVisible(true); }