/**
   * Aware-P Epanet application entry point
   *
   * @param args
   * @throws UnsupportedLookAndFeelException
   */
  public static void main(String[] args) throws UnsupportedLookAndFeelException {
    if (Utilities.isMac()) {
      System.setProperty("apple.laf.useScreenMenuBar", "true");
      System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Aware-P Epanet");

      Application app = Application.getApplication();
      app.setDockIconImage(
          Toolkit.getDefaultToolkit().getImage(EpanetUI.class.getResource("/uiresources/ae.png")));

      JMenuBar menuBar = new JMenuBar();
      JMenu fileMenu = new JMenu("File");
      menuBar.add(fileMenu);

      openAction = new JMenuItem("Open");
      saveAction = new JMenuItem("Save");
      runAction = new JMenuItem("Run");

      fileMenu.add(openAction);
      fileMenu.add(saveAction);
      fileMenu.add(runAction);
      app.setDefaultMenuBar(menuBar);
    }
    UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    new EpanetUI();
  }
Beispiel #2
0
 /** * Creates a Simple Neon Hex Frame Application * @throws IOException */
 public Main() throws IOException {
   super("Hex");
   setIconImage(Toolkit.getDefaultToolkit().getImage("images\\s1.png"));
   // Add in a menu
   JMenuBar menuBar = new JMenuBar();
   JMenu gameMenu = new JMenu("Game");
   gameMenu.setMnemonic('G');
   newMenuItem = new JMenuItem("New Game");
   newMenuItem.addActionListener(this);
   quitMenuItem = new JMenuItem("Exit");
   quitMenuItem.addActionListener(this);
   gameMenu.add(newMenuItem);
   gameMenu.addSeparator();
   gameMenu.add(quitMenuItem);
   menuBar.add(gameMenu);
   JMenu helpMenu = new JMenu("Help");
   helpMenu.setMnemonic('H');
   aboutMenuItem = new JMenuItem("About...");
   aboutMenuItem.addActionListener(this);
   helpMenu.add(aboutMenuItem);
   menuBar.add(helpMenu);
   setJMenuBar(menuBar);
   // Set up the layout
   // Centre the frame in the middle (almost) of the screen
   setLayout(new BorderLayout());
   tableArea = new Board();
   add(tableArea, BorderLayout.CENTER);
   Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
   setLocation((screen.width - Board.WIDTH) / 2, (screen.height - Board.HEIGHT) / 2 - 52);
   setResizable(false);
 }
Beispiel #3
0
 public username() {
   setLayout(new BorderLayout());
   setVisible(true);
   setResizable(false);
   int width = Toolkit.getDefaultToolkit().getScreenSize().width;
   int hight = Toolkit.getDefaultToolkit().getScreenSize().height;
   setBounds(300, 0, width - 600, hight);
   add(BorderLayout.CENTER, new p3());
 }
 @Override
 public void actionPerformed(ActionEvent ev) {
   Component component = (Component) ev.getSource();
   final String componentName = component.getName();
   switch (componentName) {
     case SAVE_MENU_ITEM_NAME:
     case SAVE_AS_MENU_ITEM_NAME:
       boolean mustChooseFile = SAVE_AS_MENU_ITEM_NAME.equals(componentName);
       saveToDisk(mustChooseFile);
       break;
     case NEW_MENU_ITEM_NAME:
     case OPEN_MENU_ITEM_NAME:
       showSaveConfirmationIfNecessaryAndRun(
           "You have changes on your current document. Save before continuing?",
           componentName,
           new Runnable() {
             @Override
             public void run() {
               if (NEW_MENU_ITEM_NAME.equals(componentName)) {
                 setSpreadsheet(new Spreadsheet());
                 setCurrentFile(null);
               } else { // open
                 Path chosenFile = chooseFile(JFileChooser.OPEN_DIALOG);
                 openSpreadsheet(chosenFile);
               }
             }
           });
       break;
     case COPY_MENU_ITEM_NAME:
       Object displayValue =
           mCellDisplayValueManager.getDisplayValueOfCellAt(getSelectedCellLocation());
       if (!"".equals(displayValue)) {
         Transferable contents = new StringSelection(displayValue.toString());
         Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, null);
       }
       break;
     case COPY_FORMULA_MENU_ITEM_NAME:
       String cellContent = mSpreadsheet.getCellContentAt(getSelectedCellLocation());
       if (cellContent != null) {
         Transferable contents = new StringSelection(cellContent);
         Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, null);
       }
       break;
     case PASTE_MENU_ITEM_NAME:
       Transferable clipboard =
           Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
       CellLocation selectedLocation = getSelectedCellLocation();
       try {
         Object transferData = clipboard.getTransferData(DataFlavor.stringFlavor);
         mTableModel.setValueAt(
             transferData.toString(), selectedLocation.getRow(), selectedLocation.getColumn());
       } catch (UnsupportedFlavorException | IOException ex) {
         // we can only use the string flavor anyway, nothing we can do here
       }
       break;
   }
 }
Beispiel #5
0
 /** 开启游戏 */
 public void startGame(MyIO io) {
   if (io.isApplet() == false) {
     try {
       setCursor(
           Toolkit.getDefaultToolkit()
               .createCustomCursor(
                   Toolkit.getDefaultToolkit().getImage(""), new Point(0, 0), "invisible"));
     } catch (Exception e) {
     }
   }
   m_game = new GameWorld(this, io);
   m_game.start();
 }
Beispiel #6
0
 /** Apply the Y-Axis tick spacing */
 protected void applyYAxisMajorTicks() {
   try {
     String text = yAxisDivisionsField.getText();
     int numTicks = Integer.parseInt(text) + 1;
     // don't change the value unless the user does to avoid inadvertantly
     // changing from autoscale
     if (numTicks < 2) {
       Toolkit.getDefaultToolkit().beep();
     } else if (numTicks != chartAdaptor.getYNumMajorTicks()) {
       chartAdaptor.setYNumMajorTicks(numTicks);
     }
   } catch (NumberFormatException excpt) {
     Toolkit.getDefaultToolkit().beep();
   }
 }
  private void initComponents() {
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

    messagePane.setBackground(contentPane.getBackground());
    messagePane.setEditorKit(new HTMLEditorKit());
    messagePane.setForeground(contentPane.getForeground());

    setSize(450, 360);

    // center the window
    int x = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() - getWidth()) / 2;
    int y = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() - getHeight()) / 2;
    setLocation(x, y);

    okButton.addActionListener(this);
  }
  public CALCView() {
    Toolkit.getDefaultToolkit();

    Constants.Get_Splash().Show_Splash_Not_Valid();

    new CALCViewFrame();
  }
  public TaskbarPositionTest() {
    super("Use CTRL-down to show a JPopupMenu");
    setContentPane(panel = createContentPane());
    setJMenuBar(createMenuBar("1 - First Menu", true));
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // CTRL-down will show the popup.
    panel
        .getInputMap()
        .put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK), "OPEN_POPUP");
    panel.getActionMap().put("OPEN_POPUP", new PopupHandler());

    pack();

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    fullScreenBounds = new Rectangle(new Point(), toolkit.getScreenSize());
    screenBounds = new Rectangle(new Point(), toolkit.getScreenSize());

    // Place the frame near the bottom. This is a pretty wild guess.
    this.setLocation(0, (int) screenBounds.getHeight() - 2 * this.getHeight());

    // Reduce the screen bounds by the insets.
    GraphicsConfiguration gc = this.getGraphicsConfiguration();
    if (gc != null) {
      Insets screenInsets = toolkit.getScreenInsets(gc);
      screenBounds = gc.getBounds();
      screenBounds.width -= (screenInsets.left + screenInsets.right);
      screenBounds.height -= (screenInsets.top + screenInsets.bottom);
      screenBounds.x += screenInsets.left;
      screenBounds.y += screenInsets.top;
    }

    setVisible(true);
  }
Beispiel #10
0
  private void warning(String msg) {
    final JDialog warn;
    JButton ok;
    JLabel message;

    warn = new JDialog();
    warn.setTitle(msg);

    message = new JLabel("CryoBay: " + msg);
    ok = new JButton("Ok");

    ok.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            warn.dispose();
          }
        });

    warn.getContentPane().setLayout(new BorderLayout());
    warn.getContentPane().add(message, "North");
    warn.getContentPane().add(ok, "South");

    warn.setSize(200, 80);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    warn.setLocation(screenSize.width / 2 - 100, screenSize.height / 2 - 40);
    warn.setResizable(false);
    warn.show();
  }
 static {
   Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
   scalex = d.width / 1920.0;
   scaley = d.height / 1080.0;
   if (scalex > 1) scalex = 1;
   if (scaley > 1) scaley = 1;
 }
Beispiel #12
0
  public APCircleWindow() {
    super("AP Circles");
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    String startDirectoryName = System.getProperty("user.dir");
    startDirectory = new File(startDirectoryName);
    // this for convenience, as the program normally starts in graph/display
    //		startDirectory = startDirectory.getParentFile();

    gw = this;

    generalXML = new GeneralXML(graph);

    gp = new APCirclePanel(this);
    getContentPane().add(gp);

    graph = gp.getGraph();

    initView();
    initExperiment();
    initUtility();
    initLayout();
    initMenu();

    setSize(width, height);

    Dimension frameDim = Toolkit.getDefaultToolkit().getScreenSize();
    int posX = (frameDim.width - getSize().width) / 2;
    int posY = (frameDim.height - getSize().height) / 2;
    setLocation(posX, posY);

    setVisible(true);

    gp.requestFocus();
  }
Beispiel #13
0
 @Override
 public void done() {
   Toolkit.getDefaultToolkit().beep();
   startButton.setEnabled(true);
   setCursor(null);
   EpubUtils.outputMessage(taskOutput, "Done");
 }
Beispiel #14
0
 public MyPanel() {
   // 在我的panel里构造一个坦克
   hero = new Hero(100, 100);
   for (int i = 0; i < enemySize; i++) {
     //			创建敌人的坦克,并加入到敌人坦克集合中。
     EnemyTank et = new EnemyTank((i + 1) * 50, 0);
     et.setColor(0);
     et.setDirection(2);
     Thread t = new Thread(et);
     t.start();
     ets.addElement(et);
   }
   image1 = Toolkit.getDefaultToolkit().getImage(Panel.class.getResource("/bomb_1.gif"));
   image2 = Toolkit.getDefaultToolkit().getImage(Panel.class.getResource("/bomb_2.gif"));
   image3 = Toolkit.getDefaultToolkit().getImage(Panel.class.getResource("/bomb_3.gif"));
 }
  class plzwai extends JFrame {
    Toolkit tk = Toolkit.getDefaultToolkit();
    int w = (int) tk.getScreenSize().getWidth();
    int h = (int) tk.getScreenSize().getHeight();

    plzwai() {
      LookAndFeel lf = UIManager.getLookAndFeel();
      try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        // UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
      } catch (Exception e) {
      }
      fplz = new JFrame("Sending The Pay Slip. Please Wait....");
      fplz.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      final JProgressBar aJProgressBar = new JProgressBar(JProgressBar.HORIZONTAL);
      // aJProgressBar.setStringPainted(true);
      aJProgressBar.setIndeterminate(true);
      fplz.add(new JPanel(), BorderLayout.NORTH);
      fplz.setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg"));
      fplz.add(new JPanel(), BorderLayout.WEST);
      fplz.add(new JPanel(), BorderLayout.EAST);
      fplz.add(new JPanel(), BorderLayout.SOUTH);
      fplz.add(aJProgressBar, BorderLayout.CENTER);
      fplz.setResizable(false);
      fplz.setLocation(h / 3, w / 4);
      fplz.setSize(700, 100);
      fplz.setVisible(true);
    }
  }
Beispiel #16
0
  /** Is called when the applet wants to be resized. */
  @Override
  public void appletResize(int width, int height) {
    currentAppletSize.width = width;
    currentAppletSize.height = height;
    final Dimension currentSize = new Dimension(currentAppletSize.width, currentAppletSize.height);

    if (loader != null) {
      AppContext appCtxt = loader.getAppContext();
      if (appCtxt != null) appEvtQ = (java.awt.EventQueue) appCtxt.get(AppContext.EVENT_QUEUE_KEY);
    }

    final AppletPanel ap = this;
    if (appEvtQ != null) {
      appEvtQ.postEvent(
          new InvocationEvent(
              Toolkit.getDefaultToolkit(),
              new Runnable() {
                @Override
                public void run() {
                  if (ap != null) {
                    ap.dispatchAppletEvent(APPLET_RESIZE, currentSize);
                  }
                }
              }));
    }
  }
Beispiel #17
0
  public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new NimbusLookAndFeel());

    Robot robot = new Robot();
    robot.setAutoDelay(50);

    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();

    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            createAndShowGUI();
          }
        });

    toolkit.realSync();

    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            Component previewPanel =
                Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel");
            point = previewPanel.getLocationOnScreen();
          }
        });

    point.translate(5, 5);

    robot.mouseMove(point.x, point.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
  }
    /*
     * Executed in event dispatching thread
     */
    @Override
    public void done() {

      try {

        String value = get();
        myMessage.messageChanged(value);

      } catch (InterruptedException e) {
        e.printStackTrace();
      } catch (ExecutionException e) {
        e.printStackTrace();
      } catch (CancellationException e) {
        myMessage.messageChanged("Operation Cancelled");
      } catch (Exception e) {
        e.printStackTrace();
      }

      Toolkit.getDefaultToolkit().beep();
      // startButton.setEnabled(true);
      // cancelButton.setEnabled(false);
      setCursor(null); // turn off the wait cursor
      StartButton.setEnabled(true);
      cancelButton.setEnabled(false);
      taskOutput.append("Done!\n");
    }
  private void addMenuItems(JMenu f, String m[]) {

    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

    for (int i = 0; i < m.length; i++) {
      if (m[i].equals("--")) {
        f.addSeparator();
      } else if (m[i].equals("---")) {

        // (ulrivo): full size on screen with less than 640 width
        if (d.width >= 640) {
          f.addSeparator();
        } else {
          return;
        }
      } else {
        JMenuItem item = new JMenuItem(m[i].substring(1));
        char c = m[i].charAt(0);

        if (c != '-') {
          item.setMnemonic(c);
        }

        item.addActionListener(this);
        f.add(item);
      }
    }
  }
Beispiel #20
0
  /** Flashes the visual bell. This class has no other public API. */
  public void flash() {
    if (GuiUtilities.isMacOs()) {
      // Mac OS has a system-wide "visual bell" that looks much better than ours.
      // You can turn this on in the Universal Access preference pane, by checking "Flash the screen
      // when an alert sound occurs".
      // We can take advantage of Apple's hard work if the user has this turned on by "actually"
      // ringing the bell.
      // This doesn't change our "no noise pollution" policy, if you ignore the very unlikely race
      // condition.
      ArrayList<String> result = new ArrayList<String>();
      ArrayList<String> errors = new ArrayList<String>();
      int status =
          ProcessUtilities.backQuote(
              null,
              new String[] {
                "defaults",
                "-currentHost",
                "read",
                "Apple Global Domain",
                "com.apple.sound.beep.flash"
              },
              result,
              errors);
      if (status == 0 && errors.size() == 0 && result.size() == 1 && result.get(0).equals("1")) {
        Toolkit.getDefaultToolkit().beep();
        return;
      }
    }

    setBellVisibility(true);
    timer.restart();
  }
Beispiel #21
0
  public void drawScreen() {
    Graphics2D g = (Graphics2D) this.getGraphics();

    g.drawImage(buffer, 0, 0, this);
    Toolkit.getDefaultToolkit().sync();
    g.dispose();
  }
  void jButtonWeights_actionPerformed(ActionEvent e) {
    NumberGeneratorDialog dlg =
        new NumberGeneratorDialog(
            (Frame) null,
            "Weights",
            "Weight of synaptic connections",
            mySynProps.getWeightsGenerator(),
            true);

    // Center the window
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = dlg.getSize();
    if (frameSize.height > screenSize.height) {
      frameSize.height = screenSize.height;
    }
    if (frameSize.width > screenSize.width) {
      frameSize.width = screenSize.width;
    }
    dlg.setLocation(
        (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    dlg.setVisible(true);

    jTextFieldWeights.setText(mySynProps.getWeightsGenerator().toShortString());

    // mySynProps.setWeightsGenerator(dlg.getFinalNumGen());
  }
    // Required by ActionListener.
    public void actionPerformed(ActionEvent e) {
      String name = employeeName.getText();

      // User didn't type in a unique name...
      if (name.equals("") || alreadyInList(name)) {
        Toolkit.getDefaultToolkit().beep();
        employeeName.requestFocusInWindow();
        employeeName.selectAll();
        return;
      }

      int index = list.getSelectedIndex(); // get selected index
      if (index == -1) { // no selection, so insert at beginning
        index = 0;
      } else { // add after the selected item
        index++;
      }

      listModel.insertElementAt(employeeName.getText(), index);
      // If we just wanted to add to the end, we'd do this:
      // listModel.addElement(employeeName.getText());

      // Reset the text field.
      employeeName.requestFocusInWindow();
      employeeName.setText("");

      // Select the new item and make it visible.
      list.setSelectedIndex(index);
      list.ensureIndexIsVisible(index);
    }
Beispiel #24
0
 /** Creates the font choice. The choice is filled with all the fonts supported by the toolkit. */
 protected JComboBox createFontChoice() {
   CommandChoice choice = new CommandChoice();
   String fonts[] = Toolkit.getDefaultToolkit().getFontList();
   for (int i = 0; i < fonts.length; i++) {
     choice.addItem(new ChangeAttributeCommand(fonts[i], "FontName", fonts[i], this));
   }
   return choice;
 }
 public void showGui() {
   pack();
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   int centerX = (int) screenSize.getWidth() / 2;
   int centerY = (int) screenSize.getHeight() / 2;
   setLocation(centerX - getWidth() / 2, centerY - getHeight() / 2);
   super.setVisible(true);
 }
 // Adds a new keybinding equal to the character provided and the default super key (ctrl/cmd)
 private static void bind(int Character) {
   frame
       .getRootPane()
       .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
       .put(
           KeyStroke.getKeyStroke(Character, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()),
           "console");
 }
 @Override
 public void removeNotify() {
   super.removeNotify();
   Toolkit.getDefaultToolkit().removeAWTEventListener(this);
   if (myJBPopup != null) {
     getUI().setPopupVisible(this, false);
     myJBPopup.cancel();
   }
 }
Beispiel #28
0
/**
 * Description: <br>
 * Copyright (C), 2005-2008, Yeeku.H.Lee <br>
 * This program is protected by copyright laws. <br>
 * Program Name: <br>
 * Date:
 *
 * @author Yeeku.H.Lee [email protected]
 * @version 1.0
 */
public class SimpleClipboard {
  private Frame f = new Frame("简单的剪贴板程序");
  // 获取系统剪贴板
  private Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  // 下面是创建本地剪贴板的代码
  // Clipboard clipboard = new Clipboard("cb");
  // 用于复制文本的文本框
  private TextArea jtaCopyTo = new TextArea(5, 20);
  // 用于粘贴文本的文本框
  private TextArea jtaPaste = new TextArea(5, 20);
  private Button btCopy = new Button("复制"); // 拷贝按钮
  private Button btPaste = new Button("粘贴"); // 粘贴按钮

  public void init() {
    Panel p = new Panel();
    p.add(btCopy);
    p.add(btPaste);
    btCopy.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            // 将一个多行文本域里的字符串封装成StringSelection对象
            StringSelection contents = new StringSelection(jtaCopyTo.getText());
            // 将StringSelection对象放入剪贴板
            clipboard.setContents(contents, null);
          }
        });
    btPaste.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            // 如果剪贴板中包含stringFlavor内容
            if (clipboard.isDataFlavorAvailable(DataFlavor.stringFlavor)) {
              try {
                // 取出剪贴板中stringFlavor内容
                String content = (String) clipboard.getData(DataFlavor.stringFlavor);
                jtaPaste.append(content);
              } catch (Exception e) {
                e.printStackTrace();
              }
            }
          }
        });
    // 创建一个水平排列的Box容器
    Box box = new Box(BoxLayout.X_AXIS);
    // 将两个多行文本域放在Box容器中
    box.add(jtaCopyTo);
    box.add(jtaPaste);
    // 将按钮所在Panel、Box容器添加到Frame窗口中
    f.add(p, BorderLayout.SOUTH);
    f.add(box, BorderLayout.CENTER);
    f.pack();
    f.setVisible(true);
  }

  public static void main(String[] args) {
    new SimpleClipboard().init();
  }
}
Beispiel #29
0
 /**
  * Loads all images to be used by the GUI, and waits for them to be fully loaded before returning.
  */
 private void loadImages() {
   MediaTracker tracker = new MediaTracker(this);
   Toolkit tk = Toolkit.getDefaultToolkit();
   background = loadImage(tk, "images/background.gif", tracker);
   try {
     tracker.waitForID(0);
   } catch (InterruptedException ie) {
   }
 }
Beispiel #30
0
  public hostelStatus() {
    setTitle("Hostel");
    connect();
    updateRecord();

    JFrame fr = new JFrame();
    Toolkit tkt = fr.getToolkit();
    Dimension frsize = tkt.getScreenSize();
    setBounds(frsize.width / 4, frsize.height / 12, frsize.width / 2, frsize.height / 8);
    setLayout(null);

    cn = getContentPane();
    cn.setBackground(new Color(190, 180, 170));

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    tl = new JLabel("Current Hostels Status");
    tl.setFont(new Font("Engravers MT", 1, 25));
    tl.setForeground(new Color(247, 251, 249));

    p1 = new JPanel();
    p1.setBounds(0, 0, 600, 50);
    p1.add(tl);
    p1.setBackground(new Color(31, 88, 166));
    cn.add(p1);

    b1 = new JButton("LOAD");
    b1.setMnemonic('L');
    b1.addActionListener(new dispListener());
    b1.setBounds(230, 320, 120, 30);

    b2 = new JButton("EXIT");
    b2.setMnemonic('X');
    b2.addActionListener(new exitListener());
    b2.setBounds(350, 320, 100, 30);

    cn.add(b1);
    cn.add(b2);

    table = new JTable(data, col);
    table.setFont(new Font("Serif", Font.BOLD, 16));
    table.setBackground(new Color(250, 250, 250));
    table.setEnabled(false);

    JScrollPane jsp = new JScrollPane(table);
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBounds(5, 100, 590, 200);
    cn.add(jsp);

    screensize = Toolkit.getDefaultToolkit().getScreenSize();

    setSize(600, 400);
    setVisible(true);
    setVisible(true);
    setResizable(true);
    connect();
  }