/** Erstellt eine Vergleichsansicht. */ protected void vergleicheWahlen() { int i = gui.anzahlWahlen(); Bundestagswahl[] wahlen = gui.getWahlen(); List<Partei> parteienListe = new LinkedList<>(); for (int j = 0; j < wahlen.length; j++) { Iterator<Partei> parteienIterator = wahlen[j].eingezogeneParteien().iterator(); while (parteienIterator.hasNext()) { Partei partei = parteienIterator.next(); Iterator<Partei> plistIterator = parteienListe.iterator(); boolean fehlt = true; while (plistIterator.hasNext() && fehlt) { Partei parteiInListe = plistIterator.next(); if (partei.getName().equals(parteiInListe.getName())) { fehlt = false; } } if (fehlt) { parteienListe.add(partei); } } } boolean parteilose = false; for (int j = 0; j < wahlen.length && !parteilose; j++) { if (wahlen[j].getParteiloseMandatstraeger() != 0) { parteilose = true; parteienListe.add(new Partei("Parteilose")); } } Collections.sort(parteienListe); JFrame frame = new JFrame(); frame.setPreferredSize(new Dimension(800, 400)); JTabbedPane tabs = new JTabbedPane(); if (i == 2) { Bundestagswahl wahl1 = wahlen[0]; Bundestagswahl wahl2 = wahlen[1]; tabs.add("Stabdiagramm", new ZweiWahlenStabdiagrammAnsicht(wahl1, wahl2, parteienListe)); tabs.add("Tabelle", new ZweiWahlenTabellenAnsicht(wahl1, wahl2, parteienListe)); } else { tabs.add("Tabellenansicht", new NWahlenTabellenAnsicht(wahlen, parteienListe)); tabs.add( "Wahlstabdiagrammansicht", new NWahlenWahlStabdiagrammAnsicht(wahlen, parteienListe)); } frame.add(tabs); setVisible(true); frame.setMinimumSize(new Dimension(900, 300)); frame.setPreferredSize(new Dimension(1000, 600)); frame.pack(); frame.setVisible(true); }
public void actionPerformed(ActionEvent e) { if (e.getSource() == b_salir) { JOptionPane.showMessageDialog( this, "Ya no estas logueado", "Fin de sesion", JOptionPane.INFORMATION_MESSAGE); actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel); actual.getContentPane().remove(0); actual.getContentPane().add(new PantallaInicio(this.rmi)); actual.setPreferredSize(new Dimension(629, 359)); actual.pack(); actual.repaint(); actual.setLocationRelativeTo(null); } else if (e.getSource() == b_Baja) { try { ControllerTES.getInstance(rmi).darseBaja(this.nomUsuario); JOptionPane.showMessageDialog( this, "Te acabas de dar de baja de THE ELDER SCROLLS CHARACTER CREATOR", "Baja usuario", JOptionPane.INFORMATION_MESSAGE); actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel); actual.getContentPane().remove(0); actual.getContentPane().add(new PantallaInicio(this.rmi)); actual.setPreferredSize(new Dimension(629, 359)); actual.pack(); actual.repaint(); actual.setLocationRelativeTo(null); } catch (RemoteException e1) { JOptionPane.showMessageDialog( this, "No te has podido dar de baja de THE ELDER SCROLLS CHARACTER CREATOR", "Error baja usuario", JOptionPane.ERROR_MESSAGE); e1.printStackTrace(); } } else if (e.getSource() == b_cargarPersonaje) { actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel); actual.getContentPane().remove(0); actual.getContentPane().add(new PantallaTablaPersonaje(nomUsuario, this.rmi)); actual.setPreferredSize(new Dimension(629, 359)); actual.pack(); actual.repaint(); actual.setLocationRelativeTo(null); } else if (e.getSource() == b_nuevoPersonaje) { actual = (JFrame) UtilidadesGUI.getContenedorPrincipal(estePanel); actual.dispose(); MenuPersonaje mp = new MenuPersonaje("PantallaLogin", this.nomUsuario, "", this.rmi); } }
@Override public void run() { ArrayList<ArrayList<Integer>> paths = new ArrayList<ArrayList<Integer>>(); buttonOpen = new JButton("Open file"); buttonOpen.addActionListener(new openFile()); openFileL = new JLabel("Open file..."); frame = new JFrame("SRPP PROJECT"); frame.setPreferredSize(new Dimension(510, 590)); frame.setResizable(false); JToolBar bar1 = new JToolBar(); bar1.setFloatable(false); bar1.add(buttonOpen); bar1.add(openFileL); bar1.setMargin(new Insets(5, 5, 5, 5)); frame.add(bar1, BorderLayout.NORTH); drawPanel = new DrawPanel(cities, paths, magazine); frame.add(drawPanel, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
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); }
public static void main(String[] args) { JFrame frame = new JFrame(); GameScreen gameScreen = new GameScreen(); frame.setPreferredSize(new Dimension(1366, 768)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // frame.setUndecorated(true); // frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setResizable(false); frame.add(gameScreen); frame.pack(); frame.setVisible(true); gameScreen.updateScreenSize(); InputFlag.reset(); while (true) { try { Thread.sleep((long) (1000f / GameScreen.FRAMERATE)); } catch (InterruptedException e) { } gameScreen.update(); gameScreen.repaint(); InputFlag.clearTrigger(); } }
private void initComponents() { frame.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); frame.setPreferredSize(new Dimension(400, 70)); frame.setSize(400, 70); frame.setLocationRelativeTo(null); textField = new JTextField(); callBtn = new JButton("Call"); callBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String msg = textField.getText(); if (msg != null & msg.trim().length() > 0) { String lang = hello.getLang(); if (lang != null) { frame.setTitle(name + " in " + lang); frame.repaint(); hello.sayHello(msg); } textField.setText(""); } } }); frame.setLayout(new BorderLayout()); frame.add(textField, BorderLayout.CENTER); frame.add(callBtn, BorderLayout.EAST); frame.getRootPane().setDefaultButton(callBtn); }
/** * Creates a new GraphicUI with the given title. * * @param title the title of the JFrame. */ public GraphicUI(String title) { JFrame.setDefaultLookAndFeelDecorated(true); f = new JFrame("BackgroundBorderExample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final Container cp = f.getContentPane(); final JPanel p = new JPanel(); p.setLayout(new BorderLayout()); BufferedImage im = ResourceLoader.getResourceLoader().getBufferedImage(Values.MenuImages + "backsmall.jpg"); Dimension size = new Dimension(im.getWidth(null), im.getHeight(null)); f.setPreferredSize(size); f.setMinimumSize(size); f.setMaximumSize(size); f.setSize(size); final Border bkgrnd = new CentredBackgroundBorder(im); Runnable r = new Runnable() { public void run() { p.setBorder(bkgrnd); cp.repaint(); } }; SwingUtilities.invokeLater(r); readFile(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); p.add(createResolution(), BorderLayout.CENTER); p.add(createStartButton(), BorderLayout.SOUTH); cp.add(p); f.setLocationRelativeTo(null); f.pack(); f.setVisible(true); }
public static void main(String args[]) throws MalformedURLException, IOException { System.out.println("YOU GIT!"); System.out.println("NO, YOU'RE A GIT!"); System.out.println("NO, YOU'RE A GIT!"); final BufferedImage img = ImageIO.read(new URL("http://www.baconbabble.com/wp-content/uploads/2011/05/smile-1.jpg")); JFrame jF = new JFrame(":)"); jF.add( new JPanel() { private static final long serialVersionUID = 3303264469218221735L; @Override public void paint(Graphics g) { g.drawImage(img, 0, 0, null); } }); jF.setResizable(false); jF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jF.setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); jF.pack(); jF.setVisible(true); }
public boolean launchOneGame(boolean visualisation) { GameStateWritable state = new GameStateWritable(maze); Game game = new Game(state); ArrayList<Path> pacmans_paths = choosePaths(); for (Path p : pacmans_paths) { System.out.println(p); game.addPacmanAgent(new Agent_FollowPath(p)); } for (int i = 0; i < state.getNumberOfGhosts(); i++) game.addGhostAgent(new IntelligentGhost_Agent1()); if (visualisation) { GamePanel panel = new GamePanel(state); game.addObserver(panel); JFrame frame = new JFrame("FrameDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(640, 480)); frame.add(panel); frame.pack(); frame.setVisible(true); GameState fstate = game.runUntilEnd(100); return (!fstate.isLose()); } else { GameState fstate = game.runUntilEnd(0); return (!fstate.isLose()); } }
/** * Cria a interface grafica para o teste * * @param jLayerPausable objeto para o teste */ public static void interfaceGrafica(JLayerPausableTest jLayerPausable) { JFrame frame = new JFrame("Test JlayerPlayerPausable"); JButton buttonPlay = new JButton("Play"); JButton buttonPause = new JButton("Pause"); JButton buttonStop = new JButton("Stop"); JPanel panel = new JPanel(new GridBagLayout()); panel.add(buttonPlay); panel.add(buttonPause); panel.add(buttonStop); buttonPlay.addActionListener(new ButtonListener(jLayerPausable)); buttonPause.addActionListener(new ButtonListener(jLayerPausable)); buttonStop.addActionListener(new ButtonListener(jLayerPausable)); frame.add(panel); frame.setPreferredSize(new Dimension(200, 100)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
public static void showSpriteCutterDialog(File file) { JFrame frame = new JFrame(); SpriteDetailsPanel sdp = new SpriteDetailsPanel(); SpriteCutterPanel scp = new SpriteCutterPanel( (int) (GUI.getInstance().getWidth() * 0.8), (int) (GUI.getInstance().getHeight() * 0.8)); scp.setPreferredSize( new Dimension( (int) (GUI.getInstance().getWidth() * 0.6), (int) (GUI.getInstance().getHeight() * 0.8))); try { scp.loadSpritesheet(file); } catch (IOException ignored) { } JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(scp), sdp); frame.add(splitPane); frame.setPreferredSize( new Dimension( (int) (GUI.getInstance().getWidth() * 0.8), (int) (GUI.getInstance().getHeight() * 0.8))); frame.setResizable(false); frame.pack(); frame.setVisible(true); }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void createAndShowQueryManager() { mainFrame.setPreferredSize(new Dimension(770, 500)); mainFrame.setLocation(400, 100); mainFrame.pack(); mainFrame.setVisible(true); mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
public GUITable() throws Exception { main_frame = new JFrame("Card Games"); main_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); main_frame.setPreferredSize(new Dimension(357, 323)); main_frame.setResizable(false); main_menu = new TableMenu(); main_frame.setJMenuBar(main_menu); Container cp = main_frame.getContentPane(); cp.setLayout(new CardLayout()); JLabel base = new JLabel("Use the game menu to start a game"); base.setHorizontalAlignment(SwingConstants.CENTER); base.setVerticalAlignment(SwingConstants.CENTER); cp.add(base, "Base"); base.setSize(cp.getSize()); main_frame.pack(); main_frame.setVisible(true); game_gui = null; games = new Hashtable<String, TableUI>(); this.host = GUIPlayer.getCurrentPlayer(); if (this.host == null) { main_menu.showNewUserDialog(main_frame); this.host = GUIPlayer.getCurrentPlayer(); if (this.host != null) main_menu.enableGameMenus(); } else main_menu.enableGameMenus(); }
/** * Creates a new Victor speed controller. * * @param channel The Digital Sidecar channel it should be connected to. */ public Victor(int channel) { frame = new JFrame("Victor Emulator: " + channel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // frame.setResizable(false); frame.setLocation(510, 0); frame.setLayout(new BorderLayout()); frame.setPreferredSize(new Dimension(300, 320)); // tells the current speed of the victor in % above the graph. victorSpeed = new JLabel("Current Speed: " + (speed * 100) + "%"); frame.add(victorSpeed, BorderLayout.NORTH); // allows user to stop the movement of the graph. button located under the graph. startStop = new JButton("Stop Graph"); startStop.addActionListener(this); frame.add(startStop, BorderLayout.SOUTH); // makes the actual graph. graph = new SpeedGrapher(300, 300); frame.add(graph, BorderLayout.CENTER); startTime = 0; isGraphRunning = true; frame.addComponentListener(this); frame.pack(); frame.setVisible(true); }
public static void main(final String[] args) { final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(800, 600)); final List<CompetitorGroup> competitors = new ArrayList<CompetitorGroup>(); for (int i = 0; i < 5; i++) { final CompetitorList compList = new CompetitorList(); for (int j = 0; j < 10; j++) { final Competitor comp = new Competitor( "Compétiteur " + i + "." + j, "prénom", new Club("code" + j, "Dep." + j, "Club " + j), CompetitorCategory.JUNIOR, j); compList.add(comp); } competitors.add(new CompetitorGroup(compList, new Algorithme())); } final MultiCompetitorGroupList list = new MultiCompetitorGroupList(competitors, 16); final JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(list); frame.getContentPane().add(scrollPane); frame.pack(); frame.setVisible(true); }
public void showList(final Data data, final String listID) { Set<String> set = signatures.get(listID); StringBuffer listToChange = new StringBuffer(); if (set != null) { Iterator<String> i = set.iterator(); while (i.hasNext()) { listToChange.append(i.next()).append("\n"); } } final JFrame frame = new JFrame("Selection List: " + listID); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLayout(new FlowLayout()); final JTextArea area = new JTextArea(); area.setColumns(80); area.setRows(15); area.setText(listToChange.toString()); JScrollPane jsp = new JScrollPane(area); JButton b1 = new JButton("Save"); b1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Set<String> newSet = new LinkedHashSet<String>(); signatures.put(listID, newSet); String text = area.getText(); String[] list = text.split("\n"); for (int i = 0; i < list.length; i++) { if (list[i].equals("")) continue; newSet.add(list[i]); } showSelectionListResult(data, listID); frame.dispose(); } }); JButton b2 = new JButton("Cancel"); b2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { frame.dispose(); } }); frame.add(jsp); frame.add(b1); frame.add(b2); if (!Constants.isWebStartMode()) { frame.setAlwaysOnTop(true); } frame.setLocation(25, 100); frame.setPreferredSize(new Dimension(950, 350)); frame.pack(); frame.setVisible(true); }
static void createAndShowGUI(Server serverPanel, String title) { JFrame frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(1200, 900)); frame.getContentPane().add(serverPanel); frame.pack(); frame.setVisible(true); }
/** main method allows us to run as a standalone demo. */ public static void main(String[] args) { JFrame frame = new JFrame(ProgressBarDemo.class.getAnnotation(DemoProperties.class).value()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new ProgressBarDemo()); frame.setPreferredSize(new Dimension(800, 600)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
public Kayttoliittyma(Sovelluslogiikka logiikka) { this.logiikka = logiikka; frame = new JFrame("Aritmetiikkaharjoittelu"); frame.setPreferredSize(new Dimension(400, 600)); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); luoKomponentit(frame.getContentPane()); frame.setJMenuBar(menubar()); }
/** * Jos tulosten latauksessa tapahtuu virhe, kutsutaan tätä metodia, näytetään graafinen * virheilmoitus; käyttäjän sulkiessa ikkunan ohjelma sulkeutuu. * * @param virheilmoitus */ public static void naytaVirheilmoitus(String virheilmoitus) { JFrame frame = new JFrame("Virhe!"); frame.setPreferredSize(new Dimension(600, 100)); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(new JLabel("Ohjelmassa tapahtui virhe: "), BorderLayout.NORTH); frame.getContentPane().add(new JLabel(virheilmoitus), BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); }
@Override public void run() { frame = new JFrame("Luolastoryömintä"); frame.setPreferredSize(new Dimension(640, 520)); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); luoKomponentit(frame.getContentPane()); frame.pack(); ; frame.setVisible(true); }
public static void main(String args[]) { JFrame frame = new JFrame("Back to School: Classroom"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); int game = 1; // frame.add(new ClassroomPanel(game, 1)); frame.setPreferredSize(new Dimension(800, 600)); frame.setVisible(true); frame.pack(); }
public tempDisplay() { // Window for viewing JFrame frame = new JFrame("Client Window"); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener(this); Dimension d = new Dimension(500, 500); frame.setSize(d); frame.setPreferredSize(d); frame.setMinimumSize(d); frame.setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); // The panel for all the messages read = new JTextArea(); read.setEditable(false); read.setLineWrap(true); read.setWrapStyleWord(true); Font font = read.getFont(); read.setFont(new Font(font.getName(), font.getStyle(), font.getSize() + 2)); JScrollPane scroll = new JScrollPane(read); scroll.setSize(read.getSize()); panel.add(scroll, BorderLayout.CENTER); // The area you write in write = new JTextField(); write.setEnabled(true); panel.add(write, BorderLayout.SOUTH); // What you do when you press enter! write.addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent arg0) {} @Override public void keyReleased(KeyEvent arg0) {} @Override public void keyTyped(KeyEvent arg0) { if (arg0.getKeyChar() == KeyEvent.VK_ENTER) { String text = write.getText(); client.send(text); write.setText(""); } } }); // Add the panel and look at it frame.add(panel); // client = new chatClient( this, "localhost", "Clifford" ); if (client.connect()) { client.start(); frame.setVisible(true); } }
private void loadGUI() { planningView = new PlanningView(model, selectedTaskModel); tableView = new ActivityTableView(model, selectedTaskModel); mainWindow = new JFrame(); mainWindow.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); mainWindow.setMinimumSize(new java.awt.Dimension(400, 400)); mainWindow.setPreferredSize(new java.awt.Dimension(900, 600)); // creation of left panel and its views jPanelRight = new JPanel(); jPanelRight.setLayout(new java.awt.GridLayout(0, 1)); jPanelRight.add(planningView.getComponent()); // Set the date limits inside the Chart View, // now limited from todays date and one year ahead GregorianCalendar start = new GregorianCalendar(); GregorianCalendar end = new GregorianCalendar(); end.add(GregorianCalendar.YEAR, 1); planningView.setDateLimits(start, end); jPanelRight.add(tableView.getComponent()); mainWindow.getContentPane().add(jPanelRight, java.awt.BorderLayout.CENTER); mainWindow.pack(); dndController = new DnDController(); chartController = new ChartController(model, selectedTaskModel, planningView.chartView, planningView); parkController = new ParkController(dndController, planningView.parkView, selectedTaskModel); tableController = new ActivityTableController(model, selectedTaskModel, tableView); plTableController = new ProductionLineController( model, planningView.chartView.productionLineView, planningView.productionLineControlView); planningView.parkView.parkController = parkController; planningView.chartView.chartController = chartController; tableView.activityTableController = tableController; /* * We add the Controller of the table as an observer of the table * so it will be noticed when a row is selected */ tableView.activityTable.getSelectionModel().addListSelectionListener(tableController); dndController.setDnDSourceAndDestination(chartController, parkController); mainWindow.setVisible(true); }
public void createAndShowGUI() { // Create frame setup Window JFrame frame = new JFrame("My View"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(250, 150)); // Add the content frame.getContentPane().add(this); // Display the window frame.pack(); frame.setVisible(true); }
@Override public void run() { frame.setPreferredSize(new Dimension(1024, 600)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); initComponents(); loadURL("http://oracle.com"); frame.pack(); frame.setVisible(true); }
/** * Purpose: Create the GUI and show it. For thread safety, this method should be invoked from the * event dispatch thread. */ private static void createAndShowGUI() { // Create and set up the window. JFrame frame = new JFrame("COMP348 TME3 Http Client"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Add content to the window. frame.add(new BrowserGUI(), BorderLayout.CENTER); frame.setPreferredSize(new Dimension(800, 600)); // Display the window. frame.pack(); frame.setVisible(true); }
private static void createAndShowGui(GameBoard view) { final JFrame frame = new JFrame("Bully And The Bots"); JComponent panel = new Main(view); panel.add(view, BorderLayout.CENTER); view.setFocusable(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(panel); frame.setPreferredSize(new Dimension(Config.WIDTH + 20, Config.HEIGHT + 94)); frame.setSize(Config.WIDTH + 20, Config.HEIGHT + 94); frame.pack(); frame.setLocation(10, 10); frame.setVisible(true); Rectangle r = frame.getBounds(); }
public Window(int width, int height, String title, Game game) { JFrame frame = new JFrame(title); frame.setPreferredSize(new Dimension(width, height + 22)); frame.setMaximumSize(new Dimension(width, height + 22)); frame.setMinimumSize(new Dimension(width, height + 22)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.add(game); frame.setVisible(true); game.start(); }
private void showSelectionListResult(Data data, String listID) { StringBuffer listToShow = new StringBuffer(); Set<String> selectionData = signatures.get(listID); Set<String> selectionDataResult = new LinkedHashSet<String>(); if (selectionData != null) { Iterator<String> i = selectionData.iterator(); while (i.hasNext()) { List<String> list = data.getVocabularyCache().searchByPattern(i.next()); Iterator<String> j = list.iterator(); while (j.hasNext()) { String call = j.next(); listToShow.append(call).append("\n"); selectionDataResult.add(call); } } } signatures.put(listID, selectionDataResult); final JFrame frame = new JFrame("Result Selection List: " + listID); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLayout(new FlowLayout()); final JTextArea area = new JTextArea(); area.setEditable(false); area.setText(listToShow.toString()); area.setColumns(80); area.setRows(15); JScrollPane jsp = new JScrollPane(area); JButton b1 = new JButton("Close"); b1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { frame.dispose(); } }); frame.add(jsp); frame.add(b1); if (!Constants.isWebStartMode()) { frame.setAlwaysOnTop(true); } frame.setLocation(25, 100); frame.setPreferredSize(new Dimension(950, 350)); frame.pack(); frame.setVisible(true); }