public static void main(String[] args) {

    StringBuffer result = new StringBuffer("<html><body><h1>Fibonacci Sequence</h1><ol>");

    long f1 = 0;
    long f2 = 1;

    for (int i = 0; i < 50; i++) {
      result.append("<li>");
      result.append(f1);
      long temp = f2;
      f2 = f1 + f2;
      f1 = temp;
    }

    result.append("</ol></body></html>");

    JEditorPane jep = new JEditorPane("text/html", result.toString());
    jep.setEditable(false);

    //  new FibonocciRectangles().execute();
    JScrollPane scrollPane = new JScrollPane(jep);
    JFrame f = new JFrame("Fibonacci Sequence");
    f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    f.setContentPane(scrollPane);
    f.setSize(512, 342);
    EventQueue.invokeLater(new FrameShower(f));
  }
Ejemplo n.º 2
0
 public void setUpGui() {
   m1 = new MyDrawPanel();
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   f.setContentPane(m1);
   f.setBounds(30, 30, 300, 300);
   f.setVisible(true);
 } // quit meth
Ejemplo n.º 3
0
  private void _displayRespStrInFrame() {

    final JFrame frame = new JFrame("Google Static Map - Error");
    GUIUtils.setAppIcon(frame, "69.png");
    // frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    JTextArea response = new JTextArea(_respStr, 25, 80);
    response.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {
            /*frame.dispose();*/
          }

          public void mouseReleased(MouseEvent e) {}

          public void mouseEntered(MouseEvent e) {}

          public void mouseExited(MouseEvent e) {}
        });

    frame.setContentPane(new JScrollPane(response));
    frame.pack();

    GUIUtils.centerOnScreen(frame);
    frame.setVisible(true);
  }
Ejemplo n.º 4
0
  public static void main(String[] arg) {

    // init table with Random

    Random alea = new Random(System.currentTimeMillis());

    for (int i = 0; i < table.length; i++) {
      table[i] = alea.nextInt(10);
    }
    System.out.println(Arrays.toString(table));

    // pick median values 3 by 3 using Arrays.sort

    for (int i = 1; (i < table.length - 1); i++) {
      int[] sort3 = {table[i - 1], table[i], table[i + 1]};
      Arrays.sort(sort3);
      median[i] = sort3[1];
      System.out.printf("%d  %d  %d : %d\n", table[i - 1], table[i], table[i + 1], median[i]);
    }
    System.out.println(Arrays.toString(median));

    // create Frame + Panel + Graphics

    JFrame cadre = new JFrame();
    JPanel ardoise = new Graph();
    cadre.setVisible(true);
    cadre.setContentPane(ardoise);
    cadre.pack();
    cadre.setLocation(100, 100);
  }
Ejemplo n.º 5
0
  void makeFrame() {
    JPanel p = new JPanel();
    p.setBackground(Color.blue);
    p.setLayout(new BorderLayout(0, 0));
    p.setBorder(new EmptyBorder(0, GAP, GAP, GAP));
    days.setFont(BIG);
    days.setForeground(COLOR);
    p.add(days, "North");
    left.setFont(NORM);
    left.setForeground(COLOR);
    p.add(left, "South");

    JFrame f = new JFrame("Sayaç"); // a window
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    f.setContentPane(p);
    setDate();
    f.pack(); // minimal size
    f.setVisible(true); // show

    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            stop();
          }
        });
  }
Ejemplo n.º 6
0
  /** GUIコンポーネントを初期化する。 */
  public void initComponent() {

    frame = new JFrame(ClientContext.getFrameTitle(title));
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            stop();
          }
        });

    JPanel contentPane = createBrowsePane();
    contentPane.setBorder(BorderFactory.createEmptyBorder(12, 12, 11, 11));

    contentPane.setOpaque(true);
    frame.setContentPane(contentPane);
    frame.pack();

    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    int n = ClientContext.isMac() ? 3 : 2;
    int x = (screen.width - frame.getPreferredSize().width) / 2;
    int y = (screen.height - frame.getPreferredSize().height) / n;
    frame.setLocation(x, y);

    blockGlass = new BlockGlass();
    frame.setGlassPane(blockGlass);

    frame.setVisible(true);
  }
  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);
  }
Ejemplo n.º 8
0
  /**
   * Create the GUI and show it. For thread safety, this method should be invoked from the
   * event-dispatching thread.
   */
  private static void createAndShowGUI() {
    // Create and set up the window.
    JFrame frame = new JFrame("Automated File Mover");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            try {
              FileOutputStream f_out = new FileOutputStream(LOG_DIRECTORY + "save.data");

              // Write object with ObjectOutputStream
              ObjectOutputStream obj_out = new ObjectOutputStream(f_out);

              // Write object out to disk
              obj_out.writeObject(directoryList);
              obj_out.writeObject(ERROR_LOG_NAME);
              obj_out.writeObject(MOVE_LOG_NAME);
              obj_out.flush();
              obj_out.close();
              printer.printError(LOG_DIRECTORY);
            } catch (IOException x) {
              printer.printError(x.toString());
            }
          }
        });

    // Create and set up the content pane.
    JComponent newContentPane = new fileBackupProgram(frame);
    newContentPane.setOpaque(true); // content panes must be opaque
    frame.setContentPane(newContentPane);

    // Display the window.
    frame.pack();
    frame.setVisible(true);
  }
 public static void main(final String[] args) {
   JFrame frame = new JFrame("Credit calculator");
   frame.setContentPane(new HypothecCalculator().mainPanel);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.pack();
   frame.setVisible(true);
 }
Ejemplo n.º 10
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);
  }
Ejemplo n.º 11
0
 public static void main(String args[]) {
   JFrame frame = new Vb0303_Extra();
   frame.setSize(400, 200);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("Voorbeeld 0303");
   frame.setContentPane(new Paneel());
   frame.setVisible(true);
 }
Ejemplo n.º 12
0
 public static void main(String[] args) {
   JFrame frame = new JFrame("GridBag1");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setSize(225, 150);
   frame.setLocation(200, 200);
   frame.setContentPane(new GridBag1());
   frame.setVisible(true);
 }
Ejemplo n.º 13
0
 public void showMainMenu() {
   frame = new JFrame("JMSUtilForm");
   frame.setContentPane(new MainMenu().panel1);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.pack();
   frame.setSize(800, 600);
   frame.setVisible(true);
 }
Ejemplo n.º 14
0
 /**
  * The main method of this class This is going to make a new JFrame, which will hold the new VOR
  * radar
  *
  * @param args
  */
 public static void main(String[] args) {
   finalVORGUI test = new finalVORGUI(90);
   JFrame frame = new JFrame("VOR Radar");
   frame.setContentPane(test);
   frame.pack();
   frame.setVisible(true);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 }
Ejemplo n.º 15
0
  private static void createAndShowGUI() {
    JComponent newContentPane = new Splitter();
    newContentPane.setOpaque(true);

    frame = new JFrame("Splitting " + EpubUtils.EPUB.getName());
    frame.setContentPane(newContentPane);
    frame.pack();
    frame.setVisible(true);
  }
Ejemplo n.º 16
0
 /**
  * Create a Canvas.
  *
  * @param title title to appear in Canvas Frame
  * @param width the desired width for the canvas
  * @param height the desired height for the canvas
  * @param bgClour the desired background colour of the canvas
  */
 private Canvas(String title, int width, int height, Color bgColour) {
   frame = new JFrame();
   canvas = new CanvasPane();
   frame.setContentPane(canvas);
   frame.setTitle(title);
   canvas.setPreferredSize(new Dimension(width, height));
   backgroundColour = bgColour;
   frame.pack();
 }
 /**
  * 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);
 }
Ejemplo n.º 18
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);
 }
Ejemplo n.º 19
0
  public MainFrame() {

    JFrame frame = new JFrame("Tanks");
    frame.setLocation(100, 100);
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.setContentPane(new MainPanel());
    //        frame.add(new MainPanel());
    frame.setMinimumSize(new Dimension(200, 200));
    frame.setVisible(true);
  }
Ejemplo n.º 20
0
  public static void showFrame() {
    JPanel panel = new TextAreaSetTabSize();
    panel.setOpaque(true);

    JFrame frame = new JFrame("JTextArea Demo");
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setContentPane(panel);
    frame.pack();
    frame.setVisible(true);
  }
 public void testFindsTopLevelWindowIfActiveWindowIsInternalFrame() {
   JFrame frame = new JFrame("testTopLevelWindow");
   JDesktopPane pane = new JDesktopPane();
   JInternalFrame internalFrame = new JInternalFrame("Test");
   pane.add(internalFrame);
   frame.setContentPane(pane);
   windowContext.setActiveWindow(internalFrame);
   assertSame(frame, windowContext.activeTopLevelWindow());
   frame.dispose();
 }
Ejemplo n.º 22
0
 private void run() {
   JFrame window = new JFrame();
   window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   window.setTitle("Analog Clock");
   ClockAnalogBuf contentPane = new ClockAnalogBuf();
   window.setContentPane(contentPane);
   window.pack(); // Layout components
   window.setLocationRelativeTo(null); // Center window.
   window.setVisible(true);
 }
Ejemplo n.º 23
0
 /**
  * This method creates a JFrame where everything will be displayed INPUT (parameters): none OUTOUT
  * (return): none
  */
 public static void createAndShowGUI() {
   JFrame frame =
       new JFrame("Black Jack"); // title of the JFrame
   BlackJack demo = new BlackJack(); // create and set up the content pane
   frame.setContentPane(demo.createContentPane());
   frame.setDefaultCloseOperation(
       JFrame.EXIT_ON_CLOSE); // what happens if the user presses the x button
   frame.setSize(950, 760);
   frame.setVisible(true); // ensure frame is visible
 }
Ejemplo n.º 24
0
  public static void main(String[] args) {
    JFrame frame = new JFrame("Click on a tutorial to run it");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel tutorialsViewer = new TutorialChooser();
    frame.setContentPane(tutorialsViewer);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
  private static void createAndShowGUI() {
    JFrame frame = new JFrame("Autofocusator");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    AutoFocusator newContentPane = new AutoFocusator();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);

    frame.pack();
    frame.setVisible(true);
  }
Ejemplo n.º 26
0
 /**
  * A simplified way to see a JPanel or other Container. Pops up a JFrame with specified Container
  * as the content pane.
  */
 public static JFrame openInJFrame(
     Container content, int width, int height, String title, Color bgColor) {
   JFrame frame = new JFrame(title);
   frame.setBackground(bgColor);
   content.setBackground(bgColor);
   frame.setSize(width, height);
   frame.setContentPane(content);
   frame.addWindowListener(new ExitListener());
   frame.setVisible(true);
   return (frame);
 }
Ejemplo n.º 27
0
 /**
  * Create a Canvas.
  *
  * @param title title to appear in Canvas Frame
  * @param width the desired width for the canvas
  * @param height the desired height for the canvas
  * @param bgClour the desired background colour of the canvas
  */
 private Canvas(String title, int width, int height, Color bgColour) {
   frame = new JFrame();
   canvas = new CanvasPane();
   frame.setContentPane(canvas);
   frame.setTitle(title);
   canvas.setPreferredSize(new Dimension(width, height));
   backgroundColour = bgColour;
   frame.pack();
   objects = new ArrayList<Object>();
   shapes = new HashMap<Object, ShapeDescription>();
 }
 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);
 }
Ejemplo n.º 29
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);
  }
Ejemplo n.º 30
0
 private static void createAndShowMain() {
   JFrame.setDefaultLookAndFeelDecorated(true);
   JFrame frame = new JFrame("RT Prune Algorithm Simulator");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setLocationRelativeTo(null);
   Main newContentPane = new Main(frame);
   newContentPane.setOpaque(true);
   frame.setContentPane(newContentPane);
   frame.pack();
   frame.setExtendedState(Frame.MAXIMIZED_BOTH);
   frame.setVisible(true);
 }