public static void main(String[] args) { // String output; Ball BigBall = new Ball(5); JFrame frame1 = new JFrame(); frame1.setTitle("Welcome to Ship!"); frame1.setSize(300, 300); frame1.setLocation(200, 100); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComboBox<String> box = new JComboBox<String>(new String[] {"Casey", "Connolly", "Nielson"}); JPanel panel = new JPanel(); panel.add(box); frame1.add(panel); frame1.setVisible(true); TV tv1 = new TV(); tv1.turnOn(); tv1.setChannel(30); tv1.setVolume(3); System.out.println(tv1.toString()); Stack stacker = new Stack(); for (int i = 0; i < 10; i++) stacker.push(i); while (!stacker.empty()) System.out.println(stacker.pop() + " "); System.out.println(BigBall.toString()); System.out.println("Finished"); }
// ---------- Constructor ---------- public DrawWindow() { // Create Main DrawWindow JFrame frame = new JFrame(TreeGen.getTitle()); frame.setVisible(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocation(0, 0); // Sets Settings For FullSCreen Mode if (TreeGen.isFullScreen()) { frame.setSize( Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height); frame.setUndecorated(true); frame.setIgnoreRepaint(true); // vc.setFullScreenWindow(); } // Sets Settings For Standard Mode else { frame.setSize( Toolkit.getDefaultToolkit().getScreenSize().width - 200, Toolkit.getDefaultToolkit().getScreenSize().height - 100); } if (TreeGen.getFPSCap() > 0) { maxWaitTime = 1000 / TreeGen.getFPSCap(); fpsCap = true; } }
private void showImage() { // 5. initialize your frame to a new JFrame() frame = new JFrame(); // 6. set the frame to visible frame.setVisible(true); frame.setSize(500, 500); frame.add(getNextRandomImage()); frame.setSize(500, 500); frame.addKeyListener(this); // 7. rename to the name of your frame // 8. set the size of the frame // 9. add a key listener to the frame // 10. Use the speak method to either say "Simon says press this key" or "Press this key" // Hint: use the simonSays int and a random number Random random = new Random(); simonSays = random.nextInt(1); if (simonSays == 0) { speak("Simon says press this key."); } else if (simonSays == 1) { speak("Press this key."); } }
public void actionPerformed(ActionEvent e) { if (e.getSource() == signin) { System.out.println(checkValidations()); if (checkValidations().equals("yes")) { String userName = userNameText.getText(); // perform your operation System.out.println(userName); String password = passwordText.getText(); // perform your operation System.out.println(password); UserLogin userLogin = UserLoginBao.getUserNameAndPassword(userName, password); System.out.println("user info" + userLogin); if (userLogin != null) { if (userName.equals(userLogin.getUserName())) { System.out.println("yes enter"); JFrame frame = new JFrame("Demo application"); System.out.println("1"); TabbedPanelExample mainFrame = new TabbedPanelExample(frame, userLogin); System.out.println("2"); frame.setSize(1350, 700); System.out.println("3"); frame.setVisible(true); this.frame.dispose(); } else { JOptionPane.showMessageDialog(null, "Please Enter Valid UserName or Password"); } } else { JOptionPane.showMessageDialog(null, "Please Enter Valid UserName or Password"); } } } if (e.getSource() == cancle) { userNameText.setText(""); // perform your operation passwordText.setText(""); // perform your operation } if (e.getSource() == signup) { this.frame.dispose(); JFrame frame = new JFrame("Demo application"); Signup signup = new Signup(frame); frame.setSize(1350, 700); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); panel.setBackground(new Color(216, 191, 216)); frame.add(panel); signup.placeComponents(panel); frame.setVisible(true); } }
// Test routine. public static void main(String[] args) { // Create a button with the label "Jackpot". JButton button = new RoundButton("Jackpot"); button.setBackground(Color.green); // Create a frame in which to show the button. JFrame frame = new JFrame(); frame.getContentPane().setBackground(Color.yellow); frame.getContentPane().add(button); frame.getContentPane().setLayout(new FlowLayout()); frame.setSize(150, 150); frame.setVisible(true); }
/** * Test method for the TestJCalendarCDatePanel class * * @param args */ public static void main(String[] args) { int old_width = 200; int old_height = 50; int new_width = 445; int new_height = 370; // Objects creation JFrame jF = new JFrame(); JCalendarDatePanel t = new JCalendarDatePanel(); // Set properties jF.setTitle("Test JCalendarDatePanel"); jF.setSize(new Dimension(old_width, old_height)); jF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jF.getContentPane().add(t); jF.setVisible(true); // Test Modal t.setModal(true); // Test resize the panel (and its button) jF.setSize(new Dimension(new_width, new_height)); // For see all panel // with the new size t.setPreferredSize(new Dimension(355, 325)); t.setSize(new Dimension(360, 320)); t.setSize(365, 325); t.revalidate(); // Test Disable Calendar Selection // t.disableCalendar(); // Tests resizing the Calendar dialog // Test set minimum dimension t.getJCalendarDateDialog().setMinimumWidth(350); t.getJCalendarDateDialog().setMinimumHeight(170); // t.getJCalendarDateDialog().setMinimumWidthScreenResolutionPercentage(0.30); // t.getJCalendarDateDialog().setMinimumHeightScreenResolutionPercentage(0.20); // Test set maximum dimension t.getJCalendarDateDialog().setMaximumWidth(500); t.getJCalendarDateDialog().setMaximumHeight(400); // t.getJCalendarDateDialog().setMaximumWidthScreenResolutionPercentage(0.60); // t.getJCalendarDateDialog().setMaximumHeightScreenResolutionPercentage(0.40); // Test Resize the component: // t.getJCalendarDateDialog().setSizeResize(350, 300); }
private void initWindow() { window.setIconImage(fsuicon); window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); window.setResizable(false); window.setLocation(400, 400); window.setSize(400, 600); window.setLayout(null); window.add(mainPanel); mainPanel.setSize(395, 570); mainPanel.setLayout(null); mainPanel.setBackground(garnet); mainPanel.setBorder(BorderFactory.createLineBorder(gold, 10)); logoLBL = new JLabel(new ImageIcon(fsutitle)); setJLabel(logoLBL, 372, 35, 10, 30); nameLBL = new JLabel(new ImageIcon(nametitle)); nameLBL.setBorder(BorderFactory.createLineBorder(gold, 5)); setJLabel(nameLBL, 400, 55, 0, 510); p1Stats = new JLabel(); setJLabel(p1Stats, 150, 50, 20, 470); p2Stats = new JLabel(); setJLabel(p2Stats, 150, 50, 225, 470); buildGridPanel(); buildMenuPanel(); }
public void newframe() { JFrame frame = new JFrame("Cab Service "); frame.setSize(800, 600); frame.setVisible(true); // frame.setBackground(Color.CYAN); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton jb = new JButton("Set Name of Places "); jb.setBounds(100, 100, 20, 50); JPanel jp = new JPanel(); jp.setBackground(Color.gray); jp.add(jb); frame.add(jp); JPanel jp1 = new JPanel(); jp1.setBackground(Color.gray); frame.add(jp1); frame.add(jp); jb.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { CreateFrame(); } catch (IOException ex) { Logger.getLogger(SetMap.class.getName()).log(Level.SEVERE, null, ex); } } }); }
/** * launches the OpenGL window * * @param GuessesToLoad */ public OpenGLView(GuessModel[] GuessesToLoad) { frame = new JFrame("Lesson01"); GLJPanel gljpanel = new GLJPanel(); GLlistener = new OpenGLViewListener(GuessesToLoad); gljpanel.addGLEventListener(GLlistener); frame.add(gljpanel); frame.setSize(800, 600); final Animator animator = new Animator(gljpanel); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { new Thread( new Runnable() { public void run() { animator.stop(); System.exit(0); } }) .start(); } }); frame.setVisible(true); animator.start(); }
public void textual() { if (!isVisible()) return; // create jeditorpane JEditorPane jEditorPane = new JEditorPane(); // make it read-only jEditorPane.setEditable(false); // create a scrollpane; modify its attributes as desired JScrollPane scrollPane = new JScrollPane(jEditorPane); // add an html editor kit HTMLEditorKit kit = new HTMLEditorKit(); jEditorPane.setEditorKit(kit); Document doc = kit.createDefaultDocument(); jEditorPane.setDocument(doc); jEditorPane.setText(floater.getText()); // now add it all to a frame JFrame j = new JFrame("Read information"); j.getContentPane().add(scrollPane, BorderLayout.CENTER); // make it easy to close the application j.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // display the frame j.setSize(new Dimension(300, 200)); // pack it, if you prefer // j.pack(); // center the jframe, then make it visible j.setLocationRelativeTo(null); j.setVisible(true); }
/** @param args the command line arguments */ public static void main(String[] args) { JFrame jf = new JFrame("DotPhysics"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(500, 300); jf.add(new DrawingPanel()); jf.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 void go() { picture(); ActionListener listener = new BtListener(); go.addActionListener(listener); btn_update_manual.addActionListener(listener); go.setForeground(Color.black); // rights.setFont((new Font("Arial", Font.PLAIN, 12))); title.setFont((new Font("Arial", Font.BOLD, 36))); title.setForeground(new Color(238, 253, 253)); today.setFont((new Font("Arial", Font.BOLD, 16))); today.setForeground(new Color(163, 184, 204)); frame.setLayout(new BorderLayout()); from.setBackground(Color.white); to.setBackground(Color.white); converted.setFont(new Font("Arial", Font.BOLD, 24)); converted.setForeground(new Color(238, 253, 253)); Lfrom.setForeground(new Color(238, 253, 253)); Lto.setForeground(new Color(238, 253, 253)); quantity.setForeground(new Color(238, 253, 253)); Lfrom.setFont(new Font("Arial", Font.BOLD, 24)); Lto.setFont(new Font("Arial", Font.BOLD, 24)); quantity.setFont(new Font("Arial", Font.BOLD, 24)); north.setLayout(new FlowLayout()); north.add(title); north.setBackground(new Color(59, 62, 71)); frame.add(BorderLayout.NORTH, north); inner.setLayout(new BorderLayout()); inner.add(BorderLayout.NORTH, today); inner.add(BorderLayout.WEST, picPanel); center.setLayout(new GridLayout(2, 4, 5, 5)); center.add(Lfrom); center.add(from); center.add(Lto); center.add(to); center.add(quantity); center.add(amount); center.add(go); inner.setBackground(new Color(59, 62, 71)); inner.add(BorderLayout.SOUTH, center); center.setBackground(new Color(59, 62, 71)); frame.add(BorderLayout.CENTER, inner); south.setBackground(new Color(59, 62, 71)); south.setLayout(new FlowLayout()); south.add(converted); south.add(answer); south.add(btn_update_manual); // south.add(rights); frame.add(BorderLayout.SOUTH, south); frame.setSize(850, 700); frame.setVisible(true); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent event) { frame.setVisible(false); frame.dispose(); System.exit(0); } }); }
/** * IRC Constructor * * @param jo the JVN object representing the Chat */ public Irc(JvnObject jo) { sentence = jo; frame = new JFrame(); frame.setLayout(new GridLayout(1, 1)); text = new TextArea(10, 60); text.setEditable(false); text.setForeground(Color.red); frame.add(text); data = new TextField(40); frame.add(data); Button read_button = new Button("read"); read_button.addActionListener(new readListener(this)); frame.add(read_button); Button write_button = new Button("write"); write_button.addActionListener(new writeListener(this)); frame.add(write_button); frame.setSize(545, 201); // frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.out.println("Closed"); try { JvnServerImpl.jvnGetServer().jvnTerminate(); } catch (Exception exc) { System.out.println("An exception: " + exc); } e.getWindow().dispose(); } }); text.setBackground(Color.black); frame.setVisible(true); }
/* * Displays gnomon in a new window. */ public void displayGnomon() { frame = new JFrame(); frame.add(this); frame.setSize(600, 800); frame.setLocationRelativeTo(null); frame.setVisible(true); }
public static void main(String[] args) { Browser browser = new Browser(); BrowserView browserView = new BrowserView(browser); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(browserView, BorderLayout.CENTER); frame.setSize(800, 600); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.setDownloadHandler( new DownloadHandler() { public boolean allowDownload(DownloadItem download) { download.addDownloadListener( new DownloadListener() { public void onDownloadUpdated(DownloadEvent event) { DownloadItem download = event.getDownloadItem(); if (download.isCompleted()) { System.out.println("Download is completed!"); } } }); System.out.println( "Destination file: " + download.getDestinationFile().getAbsolutePath()); return true; } }); browser.loadURL("ftp://ftp.teamdev.com/updates/jxbrowser-4.0-beta.zip"); }
/** *********************************************************************** */ private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); // give JFrame nice decorations JFrame frame = new JFrame("Java GUI"); // create the JFrame frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE); // set up the JFrame to end the program when it closes Container c = frame.getContentPane(); c.setLayout(new BorderLayout()); ColorBars drawingPanel = new ColorBars(); // set up the panel to draw in drawingPanel.setBackground(Color.BLACK); // the the background to black drawingPanel.btnDraw = new JButton("Click me"); // instantiate a swing button drawingPanel.btnDraw.addActionListener(drawingPanel); // register the panel with the button drawingPanel.btnClear = new JButton("Clear Screen"); drawingPanel.btnClear.addActionListener(drawingPanel); Panel buttonPanel = new Panel(); // instantiate the panel for buttons buttonPanel.add(drawingPanel.btnDraw); // add the swing button the the button panel buttonPanel.add(drawingPanel.btnClear); c.add( drawingPanel, BorderLayout.CENTER); // add the drawing panel to the frame (take up the entire frame) c.add(buttonPanel, BorderLayout.SOUTH); // add the button panel to the bottom of the frame frame.setExtendedState(JFrame.MAXIMIZED_BOTH); // set the window to maximized frame.setSize(600, 400); // set the frame size (in case user un-maximizes frame.setVisible(true); // display the frame }
/** @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here // ==================== // read the name from input spell_read sr = new spell_read(); sr.getName(); String s = sr.printName(); // ========================= // find the spell in the .txt file spell_search ss = new spell_search(); ss.search(s); Name = ss.printName(); PL = ss.printPL(); Resistable = ss.printResistable(); Type = ss.printType(); MC = ss.printMC(); Range = ss.printRange(); Limits = ss.printLimits(); Effects = ss.printEffects(); // ========================= JFrame spell_window = new JFrame("Spell Details"); spell_window.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } }); spell_window.setSize(frame_width, frame_height); spell_window.getContentPane().add(new SpellDetails()); spell_window.setVisible(true); }
public JpgMini() { f = new JFrame(); l = new JLabel(); f.getContentPane().add(l); f.setSize(640, 480); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
/** Displays the Spark error log. */ private void showErrorLog() { final File logDir = new File(Spark.getLogDirectory(), "errors.log"); // Read file and show final String errorLogs = URLFileSystem.getContents(logDir); final JFrame frame = new JFrame(Res.getString("title.client.logs")); frame.setLayout(new BorderLayout()); frame.setIconImage(SparkManager.getApplicationImage().getImage()); final JTextPane pane = new JTextPane(); pane.setBackground(Color.white); pane.setFont(new Font("Dialog", Font.PLAIN, 12)); pane.setEditable(false); pane.setText(errorLogs); frame.add(new JScrollPane(pane), BorderLayout.CENTER); final JButton copyButton = new JButton(Res.getString("button.copy.to.clipboard")); frame.add(copyButton, BorderLayout.SOUTH); copyButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.setClipboard(errorLogs); copyButton.setEnabled(false); } }); frame.pack(); frame.setSize(600, 400); GraphicUtils.centerWindowOnScreen(frame); frame.setVisible(true); }
public static void main(String[] args) { JFrame jf = new JFrame("Òƶ¯µÄÎÄ×Ö"); final JPanel jp = new JPanel() { public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.white); g2.fillRect(0, 0, 500, 400); g2.setColor(Color.black); g2.drawString("helloWorld", x, y); } }; jp.addMouseMotionListener( new MouseMotionListener() { @Override public void mouseMoved(MouseEvent e) {} @Override public void mouseDragged(MouseEvent e) { // TODO Auto-generated method stub x = e.getX(); y = e.getY(); jp.repaint(); } }); jf.add(jp); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(500, 400); jf.setVisible(true); }
public void display() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(widthPix, heightPix); frame.getContentPane().add(this); frame.setVisible(true); }
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(1000, 700); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Collision Effects Test - press any key to start"); frame.setVisible(true); frame.setFocusable(true); frame.addKeyListener( new KeyListener() { public void keyPressed(KeyEvent e) { start(); } public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) {} }); frame.add(new CollisionEffectsTest()); Ball ball = new Ball(200, 300, 3); ArrayList<Body> bodies = new ArrayList<Body>(); bodies.add(new Body(500, 300, 150, Color.blue)); level = new Level(ball, bodies, null, null, null, 5.0, 1.0); level.generateLevelData(); }
public static void main(String[] args) { final Browser browser = new Browser(); BrowserView browserView = new BrowserView(browser); final JTextField addressBar = new JTextField("http://www.teamdev.com/jxbrowser"); addressBar.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browser.loadURL(addressBar.getText()); } }); JPanel addressPane = new JPanel(new BorderLayout()); addressPane.add(new JLabel(" URL: "), BorderLayout.WEST); addressPane.add(addressBar, BorderLayout.CENTER); JFrame frame = new JFrame("JxBrowser - Hello World"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(addressPane, BorderLayout.NORTH); frame.add(browserView, BorderLayout.CENTER); frame.setSize(800, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.loadURL(addressBar.getText()); }
public static void main(String[] args) { // Desktop desk = new Desktop("Pham's Desktop", 2500, true,300, 750, 1000, true); Desktop desk = new Desktop("Dell", 2500, false, 15, 750, 1000, false); Cameras cam = new Cameras("Nikon", 500, false, 25, 550, true); Games game = new Games("Civilizations V", 29.99, true, 50, false, false); CD cd = new CD("Berzerk", 10, true, 200, "Eminem"); TV tv = new TV("Panasonic", 2000, false, 12, 900, 70); Laptop lap = new Laptop("Alienware", 980, false, 13, 750, 500, false); Movies movie = new Movies("Shrek 2", 15, true, 50, true, "Comedy", 2007); FrysProducts.list.add(cam); FrysProducts.list.add(game); FrysProducts.list.add(cd); FrysProducts.list.add(desk); FrysProducts.list.add(tv); FrysProducts.list.add(lap); FrysProducts.list.add(movie); final JFrame frame = new JFrame("Fry's Electronics"); frame.setSize(600, 600); frame.setResizable(false); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setLocation(400, 200); createGUI(frame); frame.setVisible(true); }
public void actionPerformed(ActionEvent e) { if (DBRecordStat.totalVar > 0.0) { JFrame JFrameAUC = new JFrame("AUCs for each reader and modality"); RefineryUtilities.centerFrameOnScreen(JFrameAUC); JFrameAUC.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Object[] colNames = { "ReaderID", "AUC " + DBRecordStat.modalityA, "AUC " + DBRecordStat.modalityB }; Object[][] rowContent = new String[(int) DBRecordStat.Nreader][3]; int i = 0; for (String desc_temp : InputFile1.readerIDs.keySet()) { rowContent[i][0] = desc_temp; rowContent[i][1] = Double.toString(DBRecordStat.AUCs[i][0]); rowContent[i][2] = Double.toString(DBRecordStat.AUCs[i][1]); i++; } JTable tableAUC = new JTable(rowContent, colNames); JScrollPane scrollPaneAUC = new JScrollPane(tableAUC); JFrameAUC.add(scrollPaneAUC, BorderLayout.CENTER); JFrameAUC.setSize(600, 300); JFrameAUC.setVisible(true); } else { JOptionPane.showMessageDialog( GUI.MRMCobject.getFrame(), "Pilot study data has not yet been analyzed.", "Error", JOptionPane.ERROR_MESSAGE); } }
public static void main(String args[]) { JFrame frame = new JFrame(); frame.add(new TaskFramePanel1()); frame.setVisible(true); frame.setSize(500, 500); }
public static void main(String[] args) { JFrame frame = new JFrame(); // Set the size to whatever size you like (width, height) // For projects you turn in, lets not get any bigger than 640,480 frame.setSize(640, 480); // @@@ MODIFY THIS LINE IF YOU LIKE // Set your own title frame.setTitle("Phill's Drawing"); // @@@ MODIFY THIS LINE // Always do this so that the red X (or red circle) works // to close the window. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Instantiate your drawing as a "component" PictureComponent component = new PictureComponent(); // Always add your component to the frame // and then make the window visible frame.add(component); frame.setVisible(true); }
@Override public void streamOpen() { if (isStreamOpen) { L.og("INTERNAL L ERROR: trying to re-open alreadyopen stream "); return; } logFrame = new JFrame("Logging Window"); logArea = new JTextArea(); logArea.setEditable(false); logFrame.setSize(width, height); logFrame.setResizable(false); logFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); JScrollPane logAreaScroller = new JScrollPane(logArea); logAreaScroller.setSize(logFrame.getSize()); logAreaScroller.setPreferredSize( new Dimension((logFrame.getWidth() * 3) / 4, (logFrame.getHeight() * 3) / 4)); logPanel.add(logAreaScroller); logFrame.getContentPane().add(logPanel); logFrame.setVisible(true); isStreamOpen = true; }