List of usage examples for java.awt Frame Frame
public Frame(String title) throws HeadlessException
From source file:Sampler.java
private void createImageFrame(String imageFile) { // Create the image frame. mSplitImageComponent = new SplitImageComponent(imageFile); mImageFrame = new Frame(imageFile); mImageFrame.setLayout(new BorderLayout()); mImageFrame.add(mSplitImageComponent, BorderLayout.CENTER); // Utilities.sizeContainerToComponent(mImageFrame, mSplitImageComponent); // Utilities.centerFrame(mImageFrame); mImageFrame.setVisible(true);/*from www . j av a2 s . c o m*/ }
From source file:net.sf.freecol.FreeCol.java
public static void startYourAddition() throws FontFormatException, IOException { Frame mainFrame;// ww w. ja va2 s .co m Frame mainFrame2; TextField t1; TextField t2; TextField t3; TextField t4; Frame mainFrame3 = new Frame("Haha, am i middle?"); mainFrame = new Frame("Haha, am I right?!"); mainFrame.setSize(400, 400); mainFrame.setLayout(null); t1 = new TextField("Enter here"); t1.setBounds(160, 200, 150, 50); t2 = new TextField("What grade do we deserve?"); t3 = new TextField("Enter here"); t3.setBounds(160, 200, 150, 50); t4 = new TextField("What letter grade do we deserve?"); Button b = new Button("click ----->"); b.setBounds(30, 250, 130, 30); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { t2.setText("I think you meant 100"); } }); Button c = new Button("Submit"); c.setBounds(150, 250, 80, 30); c.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String in = t1.getText(); if (in.equals("100")) { t1.setText("Correct"); t1.setEditable(false); t1.setBackground(new Color(95, 216, 109)); if (t3.getText().equals("Correct")) { mainFrame3.setVisible(true); } } else { t1.setText("Wrong"); t1.setBackground(new Color(214, 81, 96)); } } }); t2.setBounds(160, 0, 175, 100); t2.setEditable(false); mainFrame.add(b); mainFrame.add(c); mainFrame.add(t1); mainFrame.add(t2); mainFrame.setLocation(1280, 0); mainFrame.setVisible(true); ///////////////The left area below and above is right mainFrame2 = new Frame("Haha, am i left?"); mainFrame2.setSize(400, 400); mainFrame2.setLayout(null); Button b2 = new Button("click ----->"); b2.setBounds(30, 250, 130, 30); b2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { t4.setText("I think you meant A"); } }); Button c2 = new Button("Submit"); c2.setBounds(150, 250, 80, 30); c2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String in = t3.getText(); if (in.equals("A")) { t3.setText("Correct"); t3.setEditable(false); t3.setBackground(new Color(95, 216, 109)); if (t1.getText().equals("Correct")) { mainFrame3.setVisible(true); } } else { t3.setText("Wrong"); t3.setBackground(new Color(214, 81, 96)); } } }); t4.setBounds(120, 0, 220, 100); t4.setEditable(false); mainFrame2.add(b2); mainFrame2.add(c2); mainFrame2.add(t3); mainFrame2.add(t4); mainFrame2.setVisible(true); //Overall correct mainFrame3.setSize(400, 400); mainFrame3.setLayout(null); mainFrame3.setLocation(640, 420); mainFrame3.setBackground(new Color(95, 216, 109)); TextField t6 = new TextField("Soooooo give us an A!!!"); t6.setBounds(160, 200, 200, 50); t6.setBackground(new Color(102, 136, 232)); mainFrame3.add(t6); }
From source file:ch.epfl.lis.gnwgui.Simulation.java
/** * Constructor/*w w w. java 2s .c o m*/ */ public Simulation(Frame aFrame, NetworkElement item) { super(aFrame); item_ = item; GnwSettings settings = GnwSettings.getInstance(); // Model model_.setModel(new DefaultComboBoxModel( new String[] { "Deterministic (ODEs)", "Stochastic (SDEs)", "Run both (ODEs and SDEs)" })); if (settings.getSimulateODE() && !settings.getSimulateSDE()) model_.setSelectedIndex(0); else if (!settings.getSimulateODE() && settings.getSimulateSDE()) model_.setSelectedIndex(1); else if (settings.getSimulateODE() && settings.getSimulateSDE()) model_.setSelectedIndex(2); // Experiments wtSS_.setSelected(true); wtSS_.setEnabled(false); knockoutSS_.setSelected(settings.generateSsKnockouts()); knockdownSS_.setSelected(settings.generateSsKnockdowns()); multifactorialSS_.setSelected(settings.generateSsMultifactorial()); dualKnockoutSS_.setSelected(settings.generateSsDualKnockouts()); knockoutTS_.setSelected(settings.generateTsKnockouts()); knockdownTS_.setSelected(settings.generateTsKnockdowns()); multifactorialTS_.setSelected(settings.generateTsMultifactorial()); dualKnockoutTS_.setSelected(settings.generateTsDualKnockouts()); timeSeriesAsDream4_.setSelected(settings.generateTsDREAM4TimeSeries()); // Set model of "number of time series" spinner SpinnerNumberModel model = new SpinnerNumberModel(); model.setMinimum(1); model.setMaximum(10000); model.setStepSize(1); model.setValue(settings.getNumTimeSeries()); numTimeSeries_.setModel(model); // Set model of "duration" spinner model = new SpinnerNumberModel(); model.setMinimum(1); model.setMaximum(100000); model.setStepSize(10); model.setValue((int) settings.getMaxtTimeSeries()); tmax_.setModel(model); // Set model of "number of points per time series" spinner model = new SpinnerNumberModel(); model.setMinimum(3); model.setMaximum(100000); model.setStepSize(10); double dt = settings.getDt(); double maxt = settings.getMaxtTimeSeries(); int numMeasuredPoints = (int) Math.round(maxt / dt) + 1; if (dt * (numMeasuredPoints - 1) != maxt) throw new RuntimeException( "Duration of time series (GnwSettings.maxtTimeSeries_) must be a multiple of the time step (GnwSettings.dt_)"); model.setValue(numMeasuredPoints); numPointsPerTimeSeries_.setModel(model); perturbationNew_.setSelected(!settings.getLoadPerturbations()); perturbationLoad_.setSelected(settings.getLoadPerturbations()); // Noise // Diffusion multiplier (SDE only) model = new SpinnerNumberModel(); model.setMinimum(0.0); model.setMaximum(10.); model.setStepSize(0.01); model.setValue(settings.getNoiseCoefficientSDE()); sdeDiffusionCoeff_.setModel(model); noNoise_.setSelected(!settings.getAddMicroarrayNoise() && !settings.getAddNormalNoise() && !settings.getAddLognormalNoise()); useMicroarrayNoise_.setSelected(settings.getAddMicroarrayNoise()); useLogNormalNoise_.setSelected(settings.getAddNormalNoise() || settings.getAddLognormalNoise()); addGaussianNoise_.setSelected(settings.getAddNormalNoise()); addLogNormalNoise_.setSelected(settings.getAddLognormalNoise()); // Set model of "Gaussian noise std" spinner model = new SpinnerNumberModel(); model.setMinimum(0.000001); model.setMaximum(10.); model.setStepSize(0.01); model.setValue(settings.getNormalStdev()); gaussianNoise_.setModel(model); // Set model of "log-normal noise std" spinner model = new SpinnerNumberModel(); model.setMinimum(0.000001); model.setMaximum(10.); model.setStepSize(0.01); model.setValue(settings.getLognormalStdev()); logNormalNoise_.setModel(model); normalizeNoise_.setSelected(settings.getNormalizeAfterAddingNoise()); // Set the text field with the user path userPath_.setText(GnwSettings.getInstance().getOutputDirectory()); setModelAction(); setExperimentAction(); setNoiseAction(); String title1, title2; title1 = title2 = ""; if (item_ instanceof StructureElement) { ImodNetwork network = ((StructureElement) item_).getNetwork(); title1 = item_.getLabel(); title2 = network.getSize() + " nodes, " + network.getNumEdges() + " edges"; } else if (item_ instanceof DynamicalModelElement) { GeneNetwork geneNetwork = ((DynamicalModelElement) item_).getGeneNetwork(); title1 = item_.getLabel(); title2 = geneNetwork.getSize() + " genes, " + geneNetwork.getNumEdges() + " interactions"; } setHeaderInfo(title1 + " (" + title2 + ")"); // Set tool tips for all elements of the window addTooltips(); /** * ACTIONS */ model_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setModelAction(); } }); dream4Settings_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setDream4Settings(); } }); browse_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { IODialog dialog = new IODialog(new Frame(""), "Select Target Folder", GnwSettings.getInstance().getOutputDirectory(), IODialog.LOAD); dialog.selectOnlyFolder(true); dialog.display(); if (dialog.getSelection() != null) userPath_.setText(dialog.getSelection()); } }); runButton_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { enterAction(); } }); cancelButton_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { GnwSettings.getInstance().stopBenchmarkGeneration(true); escapeAction(); } }); knockoutSS_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); knockdownSS_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); multifactorialSS_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); dualKnockoutSS_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); knockoutTS_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); knockdownTS_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); multifactorialTS_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); dualKnockoutTS_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); timeSeriesAsDream4_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setExperimentAction(); } }); noNoise_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setNoiseAction(); } }); useMicroarrayNoise_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setNoiseAction(); } }); useLogNormalNoise_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setNoiseAction(); } }); addGaussianNoise_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setNoiseAction(); } }); addLogNormalNoise_.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { setNoiseAction(); } }); }
From source file:org.geoserver.wms.WMSTestSupport.java
/** * Shows <code>image</code> in a Frame. * /* w w w .j ava2s.c o m*/ * @param frameName * @param timeOut * @param image */ public static void showImage(String frameName, long timeOut, final BufferedImage image) { int width = image.getWidth(); int height = image.getHeight(); if (((System.getProperty("java.awt.headless") == null) || !System.getProperty("java.awt.headless").equals("true")) && INTERACTIVE) { Frame frame = new Frame(frameName); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { e.getWindow().dispose(); } }); Panel p = new Panel(null) { // no layout manager so it respects // setSize public void paint(Graphics g) { g.drawImage(image, 0, 0, this); } }; frame.add(p); p.setSize(width, height); frame.pack(); frame.setVisible(true); try { Thread.sleep(timeOut); } catch (InterruptedException e) { e.printStackTrace(); } frame.dispose(); } }
From source file:org.fhcrc.cpl.viewer.quant.gui.QuantitationReviewer.java
/** * Initialize all GUI components and display the UI */// w w w .jav a 2 s .c om protected void initGUI() { settingsCLM = new ProteinQuantChartsCLM(false); setTitle("Qurate"); try { setIconImage(ImageIO.read(WorkbenchFrame.class.getResourceAsStream("icon.gif"))); } catch (Exception e) { } try { Localizer.renderSwixml("org/fhcrc/cpl/viewer/quant/gui/QuantitationReviewer.xml", this); assert null != contentPanel; } catch (Exception x) { ApplicationContext.errorMessage("error creating dialog", x); throw new RuntimeException(x); } //Menu openFileAction = new OpenFileAction(this); createChartsAction = new CreateChartsAction(); filterPepXMLAction = new FilterPepXMLAction(this); proteinSummaryAction = new ProteinSummaryAction(this); try { JMenuBar jmenu = (JMenuBar) Localizer.getSwingEngine(this) .render("org/fhcrc/cpl/viewer/quant/gui/QuantitationReviewerMenu.xml"); for (int i = 0; i < jmenu.getMenuCount(); i++) jmenu.getMenu(i).getPopupMenu().setLightWeightPopupEnabled(false); this.setJMenuBar(jmenu); } catch (Exception x) { ApplicationContext.errorMessage(TextProvider.getText("ERROR_LOADING_MENUS"), x); throw new RuntimeException(x); } //Global stuff setSize(fullWidth, fullHeight); setContentPane(contentPanel); ListenerHelper helper = new ListenerHelper(this); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.PAGE_START; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(5, 5, 5, 5); gbc.weighty = 1; gbc.weightx = 1; leftPanel.setLayout(new GridBagLayout()); leftPanel.setBorder(BorderFactory.createLineBorder(Color.gray)); //Properties panel stuff propertiesTable = new QuantEvent.QuantEventPropertiesTable(); propertiesScrollPane = new JScrollPane(); propertiesScrollPane.setViewportView(propertiesTable); propertiesScrollPane.setMinimumSize(new Dimension(propertiesWidth, propertiesHeight)); //event summary table; disembodied eventSummaryTable = new QuantEventsSummaryTable(); eventSummaryTable.setVisible(true); ListSelectionModel tableSelectionModel = eventSummaryTable.getSelectionModel(); tableSelectionModel.addListSelectionListener(new EventSummaryTableListSelectionHandler()); JScrollPane eventSummaryScrollPane = new JScrollPane(); eventSummaryScrollPane.setViewportView(eventSummaryTable); eventSummaryScrollPane.setSize(propertiesWidth, propertiesHeight); eventSummaryFrame = new Frame("All Events"); eventSummaryFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { eventSummaryFrame.setVisible(false); } }); eventSummaryFrame.setSize(950, 450); eventSummaryFrame.add(eventSummaryScrollPane); //fields related to navigation navigationPanel = new JPanel(); backButton = new JButton("<"); backButton.setToolTipText("Previous Event"); backButton.setMaximumSize(new Dimension(50, 30)); backButton.setEnabled(false); forwardButton = new JButton(">"); forwardButton.setToolTipText("Next Event"); forwardButton.setMaximumSize(new Dimension(50, 30)); forwardButton.setEnabled(false); showEventSummaryButton = new JButton("Show All"); showEventSummaryButton.setToolTipText("Show all events in a table"); showEventSummaryButton.setEnabled(false); helper.addListener(backButton, "buttonBack_actionPerformed"); helper.addListener(forwardButton, "buttonForward_actionPerformed"); helper.addListener(showEventSummaryButton, "buttonShowEventSummary_actionPerformed"); gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = GridBagConstraints.RELATIVE; gbc.anchor = GridBagConstraints.WEST; navigationPanel.add(backButton, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; navigationPanel.add(forwardButton, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; navigationPanel.add(showEventSummaryButton, gbc); gbc.fill = GridBagConstraints.BOTH; navigationPanel.setBorder(BorderFactory.createTitledBorder("Event")); gbc.anchor = GridBagConstraints.PAGE_START; //Fields related to curation of events curationPanel = new JPanel(); curationPanel.setLayout(new GridBagLayout()); curationPanel.setBorder(BorderFactory.createTitledBorder("Curation")); //Quantitation curation JPanel quantCurationPanel = new JPanel(); quantCurationPanel.setLayout(new GridBagLayout()); quantCurationPanel.setBorder(BorderFactory.createTitledBorder("Quantitation")); quantCurationButtonGroup = new ButtonGroup(); JRadioButton unknownRadioButton = new JRadioButton("?"); JRadioButton goodRadioButton = new JRadioButton("Good"); JRadioButton badRadioButton = new JRadioButton("Bad"); onePeakRatioRadioButton = new JRadioButton("1-Peak"); unknownRadioButton.setEnabled(false); goodRadioButton.setEnabled(false); badRadioButton.setEnabled(false); onePeakRatioRadioButton.setEnabled(false); quantCurationButtonGroup.add(unknownRadioButton); quantCurationButtonGroup.add(goodRadioButton); quantCurationButtonGroup.add(badRadioButton); quantCurationButtonGroup.add(onePeakRatioRadioButton); unknownRadioButtonModel = unknownRadioButton.getModel(); goodRadioButtonModel = goodRadioButton.getModel(); badRadioButtonModel = badRadioButton.getModel(); onePeakRadioButtonModel = onePeakRatioRadioButton.getModel(); helper.addListener(unknownRadioButton, "buttonCuration_actionPerformed"); helper.addListener(goodRadioButton, "buttonCuration_actionPerformed"); helper.addListener(badRadioButton, "buttonCuration_actionPerformed"); helper.addListener(onePeakRadioButtonModel, "buttonCuration_actionPerformed"); gbc.anchor = GridBagConstraints.WEST; quantCurationPanel.add(unknownRadioButton, gbc); quantCurationPanel.add(badRadioButton, gbc); quantCurationPanel.add(goodRadioButton, gbc); quantCurationPanel.add(onePeakRatioRadioButton, gbc); gbc.anchor = GridBagConstraints.PAGE_START; //ID curation JPanel idCurationPanel = new JPanel(); idCurationPanel.setLayout(new GridBagLayout()); idCurationPanel.setBorder(BorderFactory.createTitledBorder("ID")); idCurationButtonGroup = new ButtonGroup(); JRadioButton idUnknownRadioButton = new JRadioButton("?"); JRadioButton idGoodRadioButton = new JRadioButton("Good"); JRadioButton idBadRadioButton = new JRadioButton("Bad"); idUnknownRadioButton.setEnabled(false); idGoodRadioButton.setEnabled(false); idBadRadioButton.setEnabled(false); idCurationButtonGroup.add(idUnknownRadioButton); idCurationButtonGroup.add(idGoodRadioButton); idCurationButtonGroup.add(idBadRadioButton); idUnknownRadioButtonModel = idUnknownRadioButton.getModel(); idGoodRadioButtonModel = idGoodRadioButton.getModel(); idBadRadioButtonModel = idBadRadioButton.getModel(); helper.addListener(idUnknownRadioButton, "buttonIDCuration_actionPerformed"); helper.addListener(idGoodRadioButton, "buttonIDCuration_actionPerformed"); helper.addListener(idBadRadioButton, "buttonIDCuration_actionPerformed"); gbc.anchor = GridBagConstraints.WEST; idCurationPanel.add(idUnknownRadioButton, gbc); idCurationPanel.add(idBadRadioButton, gbc); idCurationPanel.add(idGoodRadioButton, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; curationPanel.add(quantCurationPanel, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; curationPanel.add(idCurationPanel, gbc); //curation comment commentTextField = new JTextField(); commentTextField.setToolTipText("Comment on this event"); //saves after every keypress. Would be more efficient to save when navigating away or saving to file commentTextField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (quantEvents == null) return; QuantEvent quantEvent = quantEvents.get(displayedEventIndex); //save the comment, being careful about tabs and new lines quantEvent.setComment(commentTextField.getText().replace("\t", " ").replace("\n", " ")); } public void keyTyped(KeyEvent e) { } public void keyPressed(KeyEvent e) { } }); curationPanel.add(commentTextField, gbc); assessmentPanel = new JPanel(); assessmentPanel.setLayout(new GridBagLayout()); assessmentPanel.setBorder(BorderFactory.createTitledBorder("Algorithmic Assessment")); assessmentTypeTextField = new JTextField(); assessmentTypeTextField.setEditable(false); assessmentPanel.add(assessmentTypeTextField, gbc); assessmentDescTextField = new JTextField(); assessmentDescTextField.setEditable(false); assessmentPanel.add(assessmentDescTextField, gbc); //Theoretical peak distribution gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.CENTER; theoreticalPeaksPanel = new JPanel(); theoreticalPeaksPanel.setBorder(BorderFactory.createTitledBorder("Theoretical Peaks")); theoreticalPeaksPanel.setLayout(new GridBagLayout()); theoreticalPeaksPanel.setMinimumSize(new Dimension(leftPanelWidth - 10, theoreticalPeaksPanelHeight)); theoreticalPeaksPanel.setMaximumSize(new Dimension(1200, theoreticalPeaksPanelHeight)); showTheoreticalPeaks(); //Add everything to the left panel gbc.insets = new Insets(0, 5, 0, 5); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.PAGE_START; leftPanel.addComponentListener(new LeftPanelResizeListener()); gbc.weighty = 10; gbc.fill = GridBagConstraints.VERTICAL; leftPanel.add(propertiesScrollPane, gbc); gbc.fill = GridBagConstraints.NONE; gbc.weighty = 1; gbc.anchor = GridBagConstraints.PAGE_END; gbc.fill = GridBagConstraints.HORIZONTAL; leftPanel.add(assessmentPanel, gbc); leftPanel.add(theoreticalPeaksPanel, gbc); gbc.fill = GridBagConstraints.HORIZONTAL; leftPanel.add(curationPanel, gbc); leftPanel.add(navigationPanel, gbc); gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 1; gbc.anchor = GridBagConstraints.PAGE_START; //Chart display multiChartDisplay = new TabbedMultiChartDisplayPanel(); multiChartDisplay.setResizeDelayMS(0); rightPanel.addComponentListener(new RightPanelResizeListener()); rightPanel.add(multiChartDisplay, gbc); //status message messageLabel.setBackground(Color.WHITE); messageLabel.setFont(Font.decode("verdana plain 12")); messageLabel.setText(" "); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); //paranoia. Sometimes it seems Qurate doesn't exit when you close every window addWindowStateListener(new WindowStateListener() { public void windowStateChanged(WindowEvent e) { if (e.getNewState() == WindowEvent.WINDOW_CLOSED) { dispose(); System.exit(0); } } }); }
From source file:javazoom.jlgui.player.amp.Player.java
/** * Constructor. */ public Player() { this(null, new Frame(TITLETEXT)); }
From source file:SplineInterpolatorTest.java
public UiAlpha(Alpha alpha) { m_Alpha = alpha;/*from ww w. j a v a 2 s. c o m*/ Frame frame = new Frame("Alpha Control Panel"); JPanel panel = new JPanel(); frame.add(panel); addUiToPanel(panel); frame.pack(); frame.setSize(new Dimension(400, 80)); frame.validate(); frame.setVisible(true); }
From source file:Installer.java
public void run() { JOptionPane optionPane = new JOptionPane(this, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, new String[] { "Install", "Cancel" }); emptyFrame = new Frame("Vivecraft Installer"); emptyFrame.setUndecorated(true);//from w ww. jav a 2s. c o m emptyFrame.setVisible(true); emptyFrame.setLocationRelativeTo(null); dialog = optionPane.createDialog(emptyFrame, "Vivecraft Installer"); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); String str = ((String) optionPane.getValue()); if (str != null && ((String) optionPane.getValue()).equalsIgnoreCase("Install")) { int option = JOptionPane.showOptionDialog(null, "Please ensure you have closed the Minecraft launcher before proceeding.\n" //"Also, if installing with Forge please ensure you have installed Forge " + FORGE_VERSION + " first.", , "Important!", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); if (option == JOptionPane.OK_OPTION) { monitor = new ProgressMonitor(null, "Installing Vivecraft...", "", 0, 100); monitor.setMillisToDecideToPopup(0); monitor.setMillisToPopup(0); task = new InstallTask(); task.addPropertyChangeListener(this); task.execute(); } else { dialog.dispose(); emptyFrame.dispose(); } } else { dialog.dispose(); emptyFrame.dispose(); } }
From source file:javazoom.jlgui.player.amp.Player.java
/** * Entry point./*from w w w .j av a2 s . com*/ */ public static void main(String[] args) { Player theGUI; String currentArg = null; String currentValue = null; String skin = null; for (int i = 0; i < args.length; i++) { currentArg = args[i]; if (currentArg.startsWith("-")) { if (currentArg.toLowerCase().equals("-init")) { i++; if (i >= args.length) usage("init value missing"); currentValue = args[i]; if (Config.startWithProtocol(currentValue)) initConfig = currentValue; else initConfig = currentValue.replace('\\', '/').replace('/', java.io.File.separatorChar); } else if (currentArg.toLowerCase().equals("-song")) { i++; if (i >= args.length) usage("song value missing"); currentValue = args[i]; if (Config.startWithProtocol(currentValue)) initSong = currentValue; else initSong = currentValue.replace('\\', '/').replace('/', java.io.File.separatorChar); } else if (currentArg.toLowerCase().equals("-start")) { autoRun = true; } else if (currentArg.toLowerCase().equals("-showplaylist")) { showPlaylist = "true"; } else if (currentArg.toLowerCase().equals("-showequalizer")) { showEqualizer = "true"; } else if (currentArg.toLowerCase().equals("-skin")) { i++; if (i >= args.length) usage("skin value missing"); currentValue = args[i]; if (Config.startWithProtocol(currentValue)) skin = currentValue; else skin = currentValue.replace('\\', '/').replace('/', java.io.File.separatorChar); } else if (currentArg.toLowerCase().equals("-v")) { i++; if (i >= args.length) usage("skin version value missing"); skinVersion = args[i]; } else usage("Unknown parameter : " + currentArg); } else { usage("Invalid parameter :" + currentArg); } } // Instantiate AWT front-end. theGUI = new Player(skin, new Frame(TITLETEXT)); // Instantiate low-level player. BasicPlayer bplayer = new BasicPlayer(); // Register the front-end to low-level player events. bplayer.addBasicPlayerListener(theGUI); // Adds controls for front-end to low-level player. theGUI.setController(bplayer); // Display. theGUI.show(); if (autoRun == true) theGUI.pressStart(); }