Exemplo n.º 1
0
  public void go() throws IOException {
    // DefaultRouteTable route = new DefaultRouteTable();
    // System.out.println(route.routeInfo());
    // route.routeInfo();
    totalSize = Toolkit.getDefaultToolkit().getScreenSize(); // getting screen size
    int width = totalSize.width;
    int height = totalSize.height;
    frame = new JFrame(); // creating frame
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            FileInput data = null;
            try {
              data = new FileInput("input.txt");
            } catch (Exception e) {

            }
            String[][] origRoutes =
                convertArrayListTo2DArray(data.routeArrayList(data.routesToken), 1);
            String[][] routesList = Main.convertArrayListTo2DArray(routesInfo, 1);
            Main.changesCheck(origRoutes, routesList);
          }
        });
    frame.setTitle("Air Route Planner");
    frame.add(Panels());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize((width * 3 / 4), (height * 3 / 4));
    frame.setJMenuBar(menuBar());
    frame.setResizable(false);
    frame.setVisible(true);
    frame.setLocationRelativeTo(null);
  }
  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);
  }
Exemplo n.º 3
0
  /** *********************************************************************** */
  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
  }
  public static void main(String[] args) {
    JFrame frame = new JFrame("options");

    frame.setSize(new Dimension(500, 300));
    frame.getContentPane().add(new PackagerOptionsPanel(null));

    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            e.getWindow().dispose();
          }

          @Override
          public void windowClosed(WindowEvent e) {
            System.exit(0);
          }
        });

    try {
      SwingUtilities.invokeAndWait(new PackAndShowFrameWorker(frame));
    } catch (InterruptedException e) {
      // Immediately reasserts the exception by interrupting the caller thread itself
      Thread.currentThread().interrupt();

      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 5
0
  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);
            }
          }
        });
  }
Exemplo n.º 6
0
  // 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);
  }
Exemplo n.º 7
0
 public static void main(String[] args) {
   JFrame frame = new JFrame();
   frame.setSize(800, 600);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   GamePanel game = new GamePanel();
   frame.add(game);
   frame.setVisible(true);
 }
Exemplo n.º 8
0
 public void Window() {
   JFrame f = new JFrame("test");
   f.setSize(570, 383);
   f.add(new test());
   f.setLocationRelativeTo(null);
   f.setResizable(false);
   f.setVisible(true);
 }
Exemplo n.º 9
0
 /** Main method */
 public static void main(String[] args) {
   JFrame frame = new SimpleEventDemo2();
   frame.setTitle("SimpleEventDemo2");
   frame.setLocationRelativeTo(null); // Center the frame
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(100, 80);
   frame.setVisible(true);
 }
Exemplo n.º 10
0
 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);
 }
Exemplo n.º 11
0
  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setSize(500, 500);

    frame.add(new GMEDefaultsPanel());

    frame.setVisible(true);
  }
Exemplo n.º 12
0
  // 建立元件、將元件加入視窗、顯示視窗的方法
  public void init() {
    myframe.addKeyListener(this); // 設定按鍵事件的傾聽者

    myframe.getContentPane().add(whatkey);
    myframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    myframe.setSize(240, 120);
    myframe.setVisible(true);
  }
Exemplo n.º 13
0
 public static void main(String args[]) {
   JFrame jf = new JFrame();
   jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   BackPanel bp = new BackPanel();
   jf.add(bp);
   jf.setSize(bp.WIDTH, bp.HEIGHT);
   jf.setResizable(false);
   jf.setVisible(true);
 }
Exemplo n.º 14
0
 public void createFrame() {
   f =
       new JFrame(
           "CS 180 GUI Example 2. October 18, 2010"); // A frame object is created  and given a
                                                      // title.
   f.setSize(350, 300); // Its size is set to 350 (Wide)x300(High) pixels.
   f.add(panel); // A panel object is added to the frame.
   f.setVisible(true); // The frame is made visible.
 }
Exemplo n.º 15
0
 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);
 }
Exemplo n.º 16
0
 /** Main method */
 public static void main(String[] args) {
   JFrame frame = new JFrame("ClockAnimation");
   ClockAnimation clock = new ClockAnimation();
   frame.add(clock);
   frame.setLocationRelativeTo(null); // Center the frame
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(200, 200);
   frame.setVisible(true);
 }
Exemplo n.º 17
0
 public static void main(String[] args) {
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(600, 500);
   frame.setTitle("Breakout");
   frame.setResizable(false);
   frame.add(new GamePanel());
   frame.setVisible(true);
 }
Exemplo n.º 18
0
 /** Constructs the browser as a standalone frame. */
 private void constructStandalone() {
   frame = new JFrame("Issues");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(1024, 600);
   frame.setLocationRelativeTo(null);
   frame.getContentPane().setLayout(new BorderLayout());
   frame.getContentPane().add(constructView(), BorderLayout.CENTER);
   frame.setVisible(true);
 }
 /**
  * Test fucntion
  *
  * @param args main arguments
  * @throws SQLException if connection could not be made
  */
 public static void main(String[] args) throws SQLException {
   JFrame window = new JFrame();
   ForgotUser frame = getUserPanel();
   frame.init(connection.userInfo.UsersConnection.getInfo(8));
   window.setContentPane(frame);
   window.setSize(1080, 720);
   window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   window.setVisible(true);
 }
Exemplo n.º 20
0
 public static void main(String[] args) {
   Plot2D test = new Plot2D();
   JFrame f = new JFrame();
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   f.add(test.getContent());
   f.add(test.getUIPanel(), "Last");
   f.setSize(400, 400);
   f.setLocation(50, 50);
   f.setVisible(true);
 }
Exemplo n.º 21
0
 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);
 }
Exemplo n.º 22
0
  public JFrame buildFrame() {

    f = new JFrame("AMSA World");
    f.setSize(800, 600);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLayout(new GridBagLayout());

    textArea.setFocusable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    ActionListener listener =
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            checkInput();
          }
        };
    inputText.addActionListener(listener);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1.0;
    c.gridwidth = 3;
    c.weighty = 0.025;
    c.gridx = 0;
    c.gridy = 0;
    f.add(topPanel, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy = 1;
    f.add(scrollPane, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 1;
    c.gridx = 2;
    c.gridy = 1;
    f.add(sidePanel, c);
    sidePanel.setVisible(false);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weighty = 0.025;
    c.gridwidth = 3;
    c.gridx = 0;
    c.gridy = 2;
    f.add(inputText, c);

    f.setVisible(true);

    return f;
  }
 public static void main(String[] args) {
   ClockWithAudioOnSeparateThread applet = new ClockWithAudioOnSeparateThread();
   applet.init();
   applet.start();
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("ClockWithAudioOnSeparateThread");
   frame.getContentPane().add(applet, BorderLayout.CENTER);
   frame.setSize(400, 320);
   frame.setVisible(true);
 }
Exemplo n.º 24
0
  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();
  }
Exemplo n.º 25
0
  public static void main(String[] args) {
    frame.setLayout(new FlowLayout());

    final JPanel sceneHolder = new JPanel();
    initialize(sceneHolder);
    frame.add(sceneHolder);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(700, 700);
    frame.setVisible(true);
  }
Exemplo n.º 26
0
  /* Create and show the graphical user interface. */
  private static void createAndShowGUI() {
    JFrame frame = new JFrame("My Collapsing Puzzle");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Game game = new Game();
    frame.setJMenuBar(game.createMenuBar());
    frame.setContentPane(game.createContentPane());
    frame.setSize(game.getGameSize());

    frame.setVisible(true);
  }
 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);
 }
Exemplo n.º 28
0
  private static void createAndShowGUI() {
    JFrame fr = new JFrame("Test");

    JLabel label = new JLabel("picture");
    label.setPreferredSize(new Dimension(500, 500));
    spane = new JScrollPane(label);
    fr.getContentPane().add(spane);
    sbar = spane.getVerticalScrollBar();

    fr.setSize(200, 200);
    fr.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);
  }
Exemplo n.º 30
-1
  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);

  }