コード例 #1
0
ファイル: SampleApp.java プロジェクト: kdanninger/jac444a-3
  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);
  }
コード例 #2
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);
 }
コード例 #3
0
ファイル: Canvas.java プロジェクト: amoto/POOB-ECI
 /**
  * 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>();
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 public static void main(String[] args) {
   MojamComponent mc = new MojamComponent();
   JFrame frame = new JFrame();
   JPanel panel = new JPanel(new BorderLayout());
   panel.add(mc);
   frame.setContentPane(panel);
   frame.pack();
   frame.setResizable(false);
   frame.setLocationRelativeTo(null);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setVisible(true);
   mc.start();
 }
コード例 #6
0
ファイル: DrawbotGUI.java プロジェクト: bertbalcaen/DrawBot
  // 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.
    mainframe = new JFrame("No Drawbot Connected");
    mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    DrawbotGUI demo = DrawbotGUI.getSingleton();
    mainframe.setJMenuBar(demo.CreateMenuBar());
    mainframe.setContentPane(demo.CreateContentPane());

    // Display the window.
    mainframe.setSize(800, 700);
    mainframe.setVisible(true);
  }
コード例 #7
0
ファイル: ComboBoxDemo2.java プロジェクト: aki-s/emacs.pub
  /**
   * 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("ComboBoxDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

    // Display the window.
    frame.pack();
    frame.setVisible(true);
  }
コード例 #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("ListSelectionDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Create and set up the content pane.
    ListSelectionDemo demo = new ListSelectionDemo();
    demo.setOpaque(true);
    frame.setContentPane(demo);

    // Display the window.
    frame.pack();
    frame.setVisible(true);
  }
コード例 #9
0
  // Constructor
  public ProcessRentalView() {
    this.f = new JFrame("Process Rental");
    f.pack();
    p = new JPanel();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int height = screenSize.height;
    int width = screenSize.width;
    f.setSize(width / 2, height / 2);

    f.setLocationRelativeTo(null);
    fl = new FlowLayout(FlowLayout.CENTER);
    idLabel = new JLabel("Item ID: ");
    idTextField = new JTextField(5);
    quantityLabel = new JLabel("Quantity: ");
    quantityTextField = new JTextField(5);
    dateLabel = new JLabel("Date(MM/DD/YYYY): ");
    dateTextField = new JTextField(8);
    dateTextField.setText("");
    totalItemsLabel = new JLabel("Items:");
    totalItems = new JTextArea("");
    totalItems.setEditable(false);
    totalItems.setColumns(10);
    totalItems.setRows(12);
    totalCostLabel = new JLabel("Total Cost:");
    totalCost = new JTextField(10);
    totalCost.setEditable(false);

    addButton = new JButton("Add Item");
    exitButton = new JButton("Exit");
    checkoutButton = new JButton("Checkout");
    p.add(idLabel);
    p.add(idTextField);
    p.add(quantityLabel);
    p.add(quantityTextField);
    p.add(dateLabel);
    p.add(dateTextField);
    p.add(addButton);
    p.add(exitButton);
    p.add(totalItemsLabel);
    p.add(totalItems);
    p.add(totalCostLabel);
    p.add(totalCost);
    p.add(checkoutButton);
    p.setLayout(fl);

    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setContentPane(p);
    f.setVisible(true);
  }
コード例 #10
0
 public static void main(String[] args) { // runs when the program starts
   JFrame.setDefaultLookAndFeelDecorated(true); // give JFrame nice decorations
   JFrame frame = new JFrame("SmileyFaceClient"); // create the JFrame
   frame.setDefaultCloseOperation(
       JFrame.EXIT_ON_CLOSE); // set up the JFrame to end when user clicks X
   SmileyFaceClient panel = new SmileyFaceClient(); // make a new EmptyShell JFrame
   panel.setOpaque(true);
   panel.setBackground(Color.BLACK);
   frame.setContentPane(panel);
   frame.setSize(800, 600); // set the size of the JFrame
   frame.setVisible(true); // show the JFame
   try {
     Thread.sleep(500);
   } catch (InterruptedException e) {
   }
   panel.g = panel.getGraphics();
   panel.display(); // call the driver() method
 }
コード例 #11
0
ファイル: Animation.java プロジェクト: maeyler/Automata
  public Animation() {
    String[] keys = {"no Animator found"};
    if (tryDir(".")) // || tryDir("BLM305") || tryDir("CSE470"))
    keys = map.keySet().toArray(keys);
    System.out.println(map.size() + " classes loaded");
    menu = new JComboBox(keys);

    pan.setLayout(new BorderLayout(GAP, GAP - 4));
    pan.setBorder(new javax.swing.border.EmptyBorder(GAP, GAP, GAP, GAP));
    pan.setBackground(COLOR);

    last = new JPanel();
    last.setPreferredSize(DIM);
    pan.add(last, "Center");

    ref.setFont(NORM);
    ref.setEditable(false);
    ref.setColumns(35);
    ref.setDragEnabled(true);
    pan.add(ref, "North");

    pan.add(bottomPanel(), "South");

    pan.setToolTipText("A collective project for BLM320");
    menu.setToolTipText("Animator classes");
    who.setToolTipText("author()");
    ref.setToolTipText("description()");

    Closer ear = new Closer();
    menu.addActionListener(ear);
    stop.addActionListener(ear);
    frm.addWindowListener(ear);

    if (map.size() > 0) setItem(0);
    frm.setContentPane(pan);
    frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frm.setLocation(scaled(120), scaled(90));
    frm.pack(); // setSize() is called here
    frm.setVisible(true);
    start();
  }
コード例 #12
0
ファイル: TokenLabUI.java プロジェクト: xdy/TokenLab
  private static void createAndShowGUI() {

    JFrame frame = null;
    try {
      TokenLabUI ui = new TokenLabUI();
      frame = new ExitFrame(ui.config);
      Dimension preferredSize = new Dimension(320, 500);
      frame.setPreferredSize(preferredSize);
      ui.setDefaults();
      frame.setContentPane(ui.panel);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      frame.pack();
      frame.setVisible(true);
    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          frame,
          "Something bad happened! \n" + e.toString(),
          "Fatal error",
          JOptionPane.ERROR_MESSAGE);
    }
  }
コード例 #13
0
ファイル: Ssys3.java プロジェクト: scyptnex/computing
  public void makeGUI() {
    frm = new JFrame();
    c = frm.getContentPane();

    btnImport = new JButton("Import");
    btnImport.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            secureImport();
          }
        });
    btnMove = new JButton("Move");
    btnMove.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            secureMove();
          }
        });
    btnDelete = new JButton("Delete");
    btnDelete.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            secureDelete();
          }
        });
    btnAnalyse = new JButton("Analyse");
    btnAnalyse.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            secureAnalysis();
          }
        });

    tblItems = new JTable(store);
    tblItems.setRowSorter(tableSorter);
    tblItems.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tblItems.setFillsViewportHeight(true);
    tblItems.getRowSorter().toggleSortOrder(Storage.COL_DATE);
    tblItems.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
              tblItems.setRowSelectionInterval(
                  e.getY() / tblItems.getRowHeight(), e.getY() / tblItems.getRowHeight());
            }
            if (e.getClickCount() > 1 || e.getButton() == MouseEvent.BUTTON3) {
              int idx = tblItems.convertRowIndexToModel(tblItems.getSelectedRow());
              secureExport(idx);
            }
          }

          public void mouseEntered(MouseEvent arg0) {}

          public void mouseExited(MouseEvent arg0) {}

          public void mousePressed(MouseEvent arg0) {}

          public void mouseReleased(MouseEvent arg0) {}
        });

    txaStatus = new JTextArea(TXA_HEIGHT, TXA_WIDTH);
    txaStatus.setEditable(false);
    txaStatus.setBorder(BorderFactory.createTitledBorder("Status"));
    txaSearch = new JTextArea(4, TXA_WIDTH);
    txaSearch.setBorder(BorderFactory.createTitledBorder("Search"));
    txaSearch.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent arg0) {}

          public void keyReleased(KeyEvent arg0) {
            filterBase(txaSearch.getText());
            // EXPORT settings here, as in mass export (export everything)
            if (allowExport && txaSearch.getText().equalsIgnoreCase(CMD_EXPORT)) {
              // txaSearch.setText("");
              if (JOptionPane.showConfirmDialog(
                      frm,
                      "Do you really want to export the whole secure base?",
                      "Confirm Export",
                      JOptionPane.OK_CANCEL_OPTION)
                  == JOptionPane.OK_OPTION) {
                totalExport();
              }
            }
            // LOST X IMPORT asin look through the store for files not listed
            if (txaSearch.getText().equalsIgnoreCase(CMD_STOCKTAKE)) {
              for (int i = 0; i < storeLocs.size(); i++) {
                if (store.stockTake(i)) needsSave = true;
              }
            }
          }

          public void keyTyped(KeyEvent arg0) {}
        });

    JPanel pnlTop = new JPanel(new GridLayout(1, 4));
    JPanel pnlEast = new JPanel(new BorderLayout());
    JPanel pnlCenterEast = new JPanel(new BorderLayout());
    JScrollPane jspItems = new JScrollPane(tblItems);

    pnlTop.add(btnImport);
    pnlTop.add(btnMove);
    pnlTop.add(btnDelete);
    pnlTop.add(btnAnalyse);
    pnlCenterEast.add(txaStatus, BorderLayout.CENTER);
    pnlCenterEast.add(txaSearch, BorderLayout.NORTH);
    // pnlEast.add(pswPass, BorderLayout.NORTH);
    pnlEast.add(pnlCenterEast, BorderLayout.CENTER);
    c.setLayout(new BorderLayout());
    c.add(pnlTop, BorderLayout.NORTH);
    c.add(pnlEast, BorderLayout.EAST);
    c.add(jspItems, BorderLayout.CENTER);
    frm.setContentPane(c);
  }
コード例 #14
0
ファイル: ConvexHullGUI.java プロジェクト: goldsmcb/CS335
  public ConvexHullGUI() {

    points = new ArrayList<Point2D>();

    JFrame f = new JFrame("Convex Hull Finder");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    f.setSize(new Dimension(600, 500));

    // Add the components
    JPanel mainPanel = new JPanel();
    mainPanel.setBackground(Color.LIGHT_GRAY);
    mainPanel.setLayout(new BorderLayout());

    // On the center we add the convex hull panel and add the even listener to it
    final ConvexHullPanel chp = new ConvexHullPanel();
    chp.setPreferredSize(new Dimension(400, 400));
    chp.setBackground(Color.WHITE);
    chp.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseReleased(MouseEvent e) {
            // TODO Auto-generated method stub
            super.mouseReleased(e);

            points.add(e.getPoint());
            chp.setPoints(points);
          }
        });

    mainPanel.add(chp, BorderLayout.CENTER);

    // On the left we add another panel that contains the controls
    JPanel controlPanel = new JPanel();
    controlPanel.setBackground(Color.LIGHT_GRAY);
    controlPanel.setSize(new Dimension(100, 500));
    controlPanel.setLayout(new GridLayout(6, 1));
    // controlPanel.setLayout(new FlowLayout());

    JLabel numPointsLab = new JLabel("     # of points     ");
    controlPanel.add(numPointsLab);

    final JTextField numPoints = new JTextField(10);
    controlPanel.add(numPoints);

    JButton genPoints = new JButton("Generate Points");
    controlPanel.add(genPoints);
    genPoints.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            // Assume the text entered is an actual number
            int numberOfPoints = Integer.parseInt(numPoints.getText());

            // Make the List of Point2Ds
            points = new ArrayList<Point2D>();

            /*
            //Hard Code Points
            points.add(new Point2D.Double(200, 350));
            points.add(new Point2D.Double(100, 300));
            points.add(new Point2D.Double(200, 125));
            points.add(new Point2D.Double(100, 200));
            points.add(new Point2D.Double(300, 160));
            points.add(new Point2D.Double(350, 225));
            points.add(new Point2D.Double(230, 280));
            points.add(new Point2D.Double(190, 210));
            */

            // Generate Points
            int width = chp.getWidth();
            int height = chp.getHeight();

            for (int i = 0; i < numberOfPoints; i++) {
              // Generate 2 random numbers in the range set by the hull panel
              // and not too close to the edges so it looks good
              int x = (int) (Math.random() * (width - 50)) + 25;
              int y = (int) (Math.random() * (height - 50)) + 25;

              points.add(new Point2D.Double(x, y));
            }

            // Display them on the panel
            chp.setPoints(points);
            chp.setHull(new ArrayList<Point2D>()); // Zero out any hull that was there
          }
        });

    JRadioButton quickButton = new JRadioButton("QuickHull");
    quickButton.setSelected(true);
    theConvexHullFinder = new QuickHull();
    quickButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            theConvexHullFinder = new QuickHull();
          }
        });
    controlPanel.add(quickButton);

    JRadioButton mergeButton = new JRadioButton("MergeHull");
    mergeButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            theConvexHullFinder = new MergeHull();
          }
        });
    controlPanel.add(mergeButton);

    ButtonGroup hullChoice = new ButtonGroup();
    hullChoice.add(quickButton);
    hullChoice.add(mergeButton);

    JButton genHull = new JButton("Generate Hull");
    genHull.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {

            // Generate the hull
            List<Point2D> hullPoints = theConvexHullFinder.computeHull(points);

            // Show the results on the screen
            chp.setHull(hullPoints);
          }
        });
    controlPanel.add(genHull);

    mainPanel.add(controlPanel, BorderLayout.WEST);

    // Replace the content pane of the frame with the main panel we built
    f.setContentPane(mainPanel);
    f.setVisible(true);
  }
コード例 #15
0
  /**
   * Inizialize frame components
   *
   * @throws CMSException
   * @throws FileNotFoundException
   * @throws IOException
   * @throws GeneralSecurityException
   */
  private void initComponents()
      throws CMSException, FileNotFoundException, IOException, GeneralSecurityException {

    // *********************************

    panel4 = new JPanel();
    label2 = new JLabel();
    textPane1 = new JTextPane();
    panel5 = new JPanel();
    textArea1 = new JTextArea();
    textArea2 = new JTextArea();

    progressBar = new JProgressBar();

    textPane2 = new JTextPane();
    textField1 = new JTextField();
    button1 = new JButton();
    panel6 = new JPanel();
    button2 = new JButton();
    button3 = new JButton();
    button4 = new JButton();
    GridBagConstraints gbc;
    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());
    ((GridBagLayout) contentPane.getLayout()).columnWidths = new int[] {165, 0, 0};
    ((GridBagLayout) contentPane.getLayout()).rowHeights = new int[] {105, 50, 0};
    ((GridBagLayout) contentPane.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4};
    ((GridBagLayout) contentPane.getLayout()).rowWeights = new double[] {1.0, 0.0, 1.0E-4};

    // ======== panel4 ========
    {
      panel4.setBackground(Color.white);
      panel4.setLayout(new GridBagLayout());
      ((GridBagLayout) panel4.getLayout()).columnWidths = new int[] {160, 0};
      ((GridBagLayout) panel4.getLayout()).rowHeights = new int[] {0, 0, 0};
      ((GridBagLayout) panel4.getLayout()).columnWeights = new double[] {0.0, 1.0E-4};
      ((GridBagLayout) panel4.getLayout()).rowWeights = new double[] {1.0, 1.0, 1.0E-4};

      // ---- label2 ----
      label2.setIcon(
          new ImageIcon(
              "images" + System.getProperty("file.separator") + "logo-freesigner-piccolo.png"));
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets.bottom = 5;
      panel4.add(label2, gbc);

      // ---- textPane1 ----
      textPane1.setFont(new Font("Verdana", Font.BOLD, 12));
      textPane1.setText("Lettura\ncertificati\nda token");
      textPane1.setEditable(false);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.anchor = GridBagConstraints.NORTHWEST;
      panel4.add(textPane1, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets.bottom = 5;
    gbc.insets.right = 5;
    contentPane.add(panel4, gbc);

    // ======== panel5 ========
    {
      panel5.setBackground(Color.white);
      panel5.setLayout(new GridBagLayout());
      ((GridBagLayout) panel5.getLayout()).columnWidths = new int[] {0, 205, 0, 0};
      ((GridBagLayout) panel5.getLayout()).rowHeights = new int[] {100, 0, 30, 30, 0};
      ((GridBagLayout) panel5.getLayout()).columnWeights = new double[] {1.0, 0.0, 1.0, 1.0E-4};
      ((GridBagLayout) panel5.getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0, 1.0, 1.0E-4};

      // ---- textArea1 ----
      textArea1.setFont(new Font("Verdana", Font.BOLD, 14));
      textArea1.setText("Lettura certificati da token");
      textArea1.setEditable(false);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.gridwidth = 3;
      gbc.fill = GridBagConstraints.VERTICAL;
      gbc.insets.bottom = 5;
      panel5.add(textArea1, gbc);

      // ---- textArea2 ----
      textArea2.setFont(new Font("Verdana", Font.PLAIN, 12));
      textArea2.setText("Ricerca certificati...\n");
      textArea2.setEditable(false);
      textArea2.setColumns(30);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.gridwidth = 3;
      gbc.fill = GridBagConstraints.BOTH;
      panel5.add(textArea2, gbc);
      progressBar.setValue(0);
      progressBar.setMaximum(1);
      progressBar.setStringPainted(true);
      progressBar.setBounds(0, 0, 300, 150);

      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 2;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets.bottom = 5;
      gbc.insets.right = 5;
      gbc.gridwidth = 3;
      panel5.add(progressBar, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets.bottom = 5;
    contentPane.add(panel5, gbc);

    // ======== panel6 ========
    {
      panel6.setBackground(Color.white);
      panel6.setLayout(new GridBagLayout());
      ((GridBagLayout) panel6.getLayout()).columnWidths = new int[] {0, 0, 0, 0};
      ((GridBagLayout) panel6.getLayout()).rowHeights = new int[] {0, 0};
      ((GridBagLayout) panel6.getLayout()).columnWeights = new double[] {1.0, 1.0, 1.0, 1.0E-4};
      ((GridBagLayout) panel6.getLayout()).rowWeights = new double[] {1.0, 1.0E-4};

      // ---- button2 ----
      button2.setText("Indietro");
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.insets.right = 5;
      button2.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {

              frame.hide();

              FreeSignerSignApplet nuovo = new FreeSignerSignApplet();
            }
          });

      // panel6.add(button2, gbc);

      // ---- button4 ----
      button4.setText("Annulla");
      gbc = new GridBagConstraints();
      gbc.gridx = 2;
      gbc.gridy = 0;
      // panel6.add(button4, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.BOTH;
    contentPane.add(panel6, gbc);
    contentPane.setBackground(Color.white);
    frame = new JFrame();
    frame.setContentPane(contentPane);
    frame.setTitle("Freesigner");
    frame.setSize(300, 150);
    frame.setResizable(false);
    frame.pack();
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getWidth()) / 2, (d.height - frame.getHeight()) / 2);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    timer =
        new Timer(
            10,
            new ActionListener() {

              public void actionPerformed(ActionEvent evt) {
                frame.show();
                if (task.getMessage() != null) {
                  String s = new String();
                  s = task.getMessage();
                  s = s.substring(0, Math.min(60, s.length()));

                  textArea2.setText(s + " ");
                  progressBar.setValue(task.getStatus());
                }
                if (task.isDone()) {
                  timer.stop();

                  // Finalizzo la cryptoki, onde evitare
                  // successivi errori PKCS11 "cryptoki alreadi initialized"

                  if ((task != null)) task.libFinalize();

                  ArrayList slotInfos = task.getSlotInfos();
                  if ((slotInfos == null) || slotInfos.isEmpty()) {

                    frame.show();

                    JOptionPane.showMessageDialog(
                        frame,
                        "Controllare la presenza sul sistema\n"
                            + "della libreria PKCS11 impostata.",
                        "Nessun lettore rilevato",
                        JOptionPane.WARNING_MESSAGE);

                    frame.hide();

                  } else {
                    String st = task.getCRLerror();

                    if (st.length() > 0) {
                      timer.stop();

                      JOptionPane.showMessageDialog(
                          frame,
                          "C'è stato un errore nella verifica CRL.\n" + st,
                          "Errore verifica CRL",
                          JOptionPane.ERROR_MESSAGE);
                      frame.hide();
                      FreeSignerSignApplet nuovo = new FreeSignerSignApplet();
                    }
                    if (task.getDifferentCerts() == 0) {
                      if (task.getCIr() != null) {
                        JOptionPane.showMessageDialog(
                            frame,
                            "La carta "
                                + task.getCardDescription()
                                + " nel lettore "
                                + conf.getReader()
                                + " non contiene certificati",
                            "Attenzione",
                            JOptionPane.WARNING_MESSAGE);

                      } else
                        JOptionPane.showMessageDialog(
                            frame, task.getMessage(), "Errore:", JOptionPane.ERROR_MESSAGE);
                    }

                    frame.hide();

                    // confFrame.createTreeAndTokenNodes(task.getSlotInfos());

                  }
                }
              }
            });
  }
コード例 #16
0
  BallDetector(boolean _display) {

    ctx = Freenect.createContext();
    if (ctx.numDevices() > 0) {
      kinect = ctx.openDevice(0);
    } else {
      System.err.println("WARNING: No kinects detected");
      return;
    }
    display = _display;

    controlFrame = new JFrame("Controls");
    controlFrame.setLayout(new GridLayout(5, 1));
    controlFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pg = new ParameterGUI();
    pg.addIntSlider("maxDepth", "max depth", 800, 2047, 1050);
    pg.addIntSlider("blobThresh", "blob thresh", 1, 500, 125);
    pg.addIntSlider("thresh", "thresh", 1, 100, 10);
    pg.addIntSlider("frames", "frames", 1, 1000, 1);
    pg.addListener(
        new ParameterListener() {
          public void parameterChanged(ParameterGUI _pg, String name) {
            if (name.equals("thresh")) {
              KinectDepthVideo.THRESH = _pg.gi(name);
            } else if (name.equals("frames")) {
              KinectDepthVideo.MAX_FRAMES = _pg.gi(name);
            } else if (name.equals("maxDepth")) {
              KinectDepthVideo.MAX_DEPTH = _pg.gi(name);
            }
          }
        });
    controlFrame.add(pg, 0, 0);

    startTracking = new JButton("Start Tracking Balls");
    startTracking.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            if (!tracking) {
              tracking = true;
              colorStream.pause();
              depthStream.pause();
              startTracking.setText("Stop Tracking");
            } else {
              tracking = false;
              colorStream.resume();
              depthStream.resume();
              startTracking.setText("Start Tracking Balls");
            }
          }
        });
    controlFrame.add(startTracking, 1, 0);

    resetProjectile = new JButton("Reset Projectile");
    resetProjectile.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              lcm.publish("6_RESET", "reset");
            } catch (IOException ex) {
              System.out.println("can't publish reset");
            }
          }
        });
    controlFrame.add(resetProjectile, 2, 0);
    resetDepth = new JButton("Reset Depth Avgs");
    resetDepth.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            DepthClearer ic = new DepthClearer(pg);
            ic.start();
          }
        });
    controlFrame.add(resetDepth, 3, 0);
    JPanel scoreButtons = new JPanel(new GridLayout(1, 3));
    JButton addHuman = new JButton("human++");
    addHuman.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              lcm.publish("6_SCORE_HUMAN", "bish");
            } catch (IOException ex) {
              System.out.println("can't publish score");
            }
          }
        });
    JButton addRobot = new JButton("robot++");
    addRobot.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              lcm.publish("6_SCORE_ROBOT", "bish");
            } catch (IOException ex) {
              System.out.println("can't publish score");
            }
          }
        });
    JButton resetScores = new JButton("reset scores");
    resetScores.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              lcm.publish("6_SCORE_RESET", "bish");
            } catch (IOException ex) {
              System.out.println("can't publish score");
            }
          }
        });
    scoreButtons.add(addHuman, 0, 0);
    scoreButtons.add(addRobot, 0, 1);
    scoreButtons.add(resetScores, 0, 2);
    controlFrame.add(scoreButtons, 4, 0);
    controlFrame.setSize(800, 600);
    controlFrame.setVisible(true);

    colorFrame = new JFrame("color feed");
    colorMonitor = new Object();
    colorStream = new KinectRGBVideo(kinect, colorMonitor, display);
    colorFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    colorFrame.addWindowListener(new RGBClose());
    colorFrame.setSize(KinectVideo.WIDTH, KinectVideo.HEIGHT);
    colorFrame.setContentPane(colorStream);
    colorFrame.setVisible(true);

    depthFrame = new JFrame("depth feed");
    depthMonitor = new Object();
    depthStream = new KinectDepthVideo(kinect, depthMonitor, display);
    depthFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    depthFrame.setSize(KinectVideo.WIDTH, KinectVideo.HEIGHT);
    depthFrame.setContentPane(depthStream);
    depthFrame.setVisible(true);

    rgbImg = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB);
    depthImg = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB);

    validImageValue = new boolean[KinectVideo.WIDTH * KinectVideo.HEIGHT];
    try {
      lcm = new LCM("udpm://239.255.76.67:7667?ttl=1");
    } catch (IOException e) {
      lcm = LCM.getSingleton();
    }
    BALL = new Statistics();

    finder = new BallTracker(KinectVideo.WIDTH, KinectVideo.HEIGHT, false);

    if (display) {
      depthImg = depthStream.getFrame();
      rgbImg = colorStream.getFrame();
    }
    // get robot position from click
    depthStream.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            Point botPix = e.getPoint();
            botStart = depthStream.getWorldCoords(botPix);
            botStart.z += 0.08;
            System.out.println("botStart: " + botStart.toString());
            depthStream.showSubtraction();
            depthStream.botLoc = botPix;
          }
        });
    DepthClearer ic = new DepthClearer(pg);
    ic.start();
  }
コード例 #17
0
ファイル: SampleApp.java プロジェクト: kdanninger/jac444a-3
  private void _displayImgInFrame() {

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

    JLabel imgLbl = new JLabel(new ImageIcon(_img));
    imgLbl.setToolTipText(
        MessageFormat.format(
            "<html>Image downloaded from URI<br>size: w={0}, h={1}</html>",
            _img.getWidth(), _img.getHeight()));

    GUIUtils.centerOnScreen(frame);
    frame.setVisible(true);
    frame.setContentPane(imgLbl);
    frame.pack();
    frame.setResizable(false);

    imgLbl.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {

            System.out.println("Mouse Listener:  Mouse Clicked!");
            mapIsUp = 1;
            sentX = 0.00;
            clickX = e.getX(); // Latitude
            clickY = e.getY(); // Longitude
            if ((clickX < (_img.getWidth() / 2))
                && (clickY < (_img.getHeight() / 2))) { // 1st quadrant positive values
              sentX =
                  Double.parseDouble(ttfLati.getText())
                      + (((-1 * (_img.getWidth() / 2)) + clickX) * pixelX); // Add to latitude
              sentY =
                  Double.parseDouble(ttfLongi.getText())
                      + (((_img.getHeight() / 2) - clickY) * pixelY); // Add to Longitude
              System.out.println("Top left");
            } else if ((clickX > (_img.getWidth() / 2))
                && (clickY > (_img.getHeight() / 2))) { // 2nd quadrant negative values
              sentX =
                  Double.parseDouble(ttfLati.getText())
                      + (((-1 * (_img.getHeight() / 2)) + clickX) * pixelX);
              sentY =
                  Double.parseDouble(ttfLongi.getText())
                      + (((_img.getHeight() / 2) - clickY) * pixelY);
              System.out.println("Bottom Right");
            } else if ((clickX < (_img.getWidth() / 2))
                && (clickY > (_img.getHeight() / 2))) { // 3rd quadrant 1 positive 1 negative
              sentX =
                  Double.parseDouble(ttfLati.getText())
                      + (((-1 * (_img.getWidth() / 2)) + clickX) * pixelX);
              sentY =
                  Double.parseDouble(ttfLongi.getText())
                      + (((_img.getHeight() / 2) - clickY) * pixelY);
              System.out.println("Bottom Left");
            } else { // 3rd quadrant 1 positive 1 negative
              sentX =
                  Double.parseDouble(ttfLati.getText())
                      + (((-1 * (_img.getHeight() / 2)) + clickX) * pixelX);
              sentY =
                  Double.parseDouble(ttfLongi.getText())
                      + (((_img.getHeight() / 2) - clickY) * pixelY);
              System.out.println("Top Right");
            }

            BigDecimal toCoordsX = new BigDecimal(sentX);
            BigDecimal toCoordsY = new BigDecimal(sentY);

            sentX =
                (toCoordsX.setScale(6, BigDecimal.ROUND_HALF_UP))
                    .doubleValue(); // allows values of up to 6 decimal places
            sentY = (toCoordsY.setScale(6, BigDecimal.ROUND_HALF_UP)).doubleValue();
            getCoords = sentX + " " + sentY;
            ttfLati.setText(Double.toString(sentX));
            ttfLongi.setText(Double.toString(sentY));

            System.out.println("... saving Coordinates");
            saveLocation(
                getCoords); // pass getCoords through saveLocation. this string is appended to the
                            // savedLocations file.
            System.out.println("... savedCoordinates");

            // Update the Locations ComboBox with new additions
            ttfSave.removeAllItems(); // re-populate the ComboBox
            System.out.println("removed items");

            getSavedLocations(); // run through file to get all locations
            for (int i = 0; i < loc.size(); i++) ttfSave.addItem(loc.get(i));
            System.out.println("update combobox");
            mapIsUp = 0;
            frame.dispose(); // closes window
            startTaskAction(); // pops up a new window
          }

          public void saveLocation(String xy) {
            BufferedWriter f = null; // created a bufferedWriter object

            try {
              f =
                  new BufferedWriter(
                      new FileWriter(
                          "savedLocations.txt",
                          true)); // evaluated true if file has not been created yet
              f.write(xy); // append passed coordinates and append to file if exists
              f.newLine();
              f.flush();
            } catch (IOException ioe) {
              ioe.printStackTrace();
            } finally { // close the file
              if (f != null) {

                try {
                  f.close();
                } catch (IOException e) { // any error, catch exception
                  System.err.println("Error: " + e.getMessage());
                }
              }
            }
          }

          public void mouseReleased(MouseEvent e) {}

          public void mouseEntered(MouseEvent e) {}

          public void mouseExited(MouseEvent e) {}
        });
  }
コード例 #18
0
ファイル: ParamerSet.java プロジェクト: hdwt8289/SerialSlave1
  public void setFrame() {
    f = new JFrame("数据通讯参数设置");
    // 获取屏幕分辨率的工具集
    Toolkit tool = Toolkit.getDefaultToolkit();
    // 利用工具集获取屏幕的分辨率
    Dimension dim = tool.getScreenSize();
    // 获取屏幕分辨率的高度
    int height = (int) dim.getHeight();
    // 获取屏幕分辨率的宽度
    int width = (int) dim.getWidth();
    // 设置位置
    f.setLocation((width - 300) / 2, (height - 400) / 2);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.pack();
    f.setVisible(true);
    f.setContentPane(this);
    f.setSize(320, 260);
    f.setResizable(false);

    lblIP = new JLabel("主机名");
    txtIp = new JTextField(20);
    try {
      InetAddress addr = InetAddress.getLocalHost();
      txtIp.setText(addr.getHostAddress().toString());
    } catch (Exception ex) {
    }

    lblNo = new JLabel("端口号");
    cmbNo = new JComboBox();
    cmbNo.setEditable(true);
    cmbNo.addPopupMenuListener(
        new PopupMenuListener() {
          @Override
          public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            cmbNo.removeAllItems();
            CommPortIdentifier portId = null;
            Enumeration portList;
            portList = CommPortIdentifier.getPortIdentifiers();
            while (portList.hasMoreElements()) {
              portId = (CommPortIdentifier) portList.nextElement();
              cmbNo.addItem(portId.getName());
            }
          }

          @Override
          public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            // To change body of implemented methods use File | Settings | File Templates.
          }

          @Override
          public void popupMenuCanceled(PopupMenuEvent e) {
            // To change body of implemented methods use File | Settings | File Templates.
          }
        });

    lblName = new JLabel("工程名");
    txtProjectName = new JComboBox();
    txtProjectName.setEditable(true);
    txtProjectName.addPopupMenuListener(
        new PopupMenuListener() {
          @Override
          public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            txtProjectName.removeAllItems();
            Mongo m1 = null;
            try {
              m1 = new Mongo(txtIp.getText().toString(), 27017);
            } catch (UnknownHostException ex) {
              ex.printStackTrace();
            }
            for (String name : m1.getDatabaseNames()) {
              txtProjectName.addItem(name);
            }
            m1.close();
          }

          @Override
          public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            // To change body of implemented methods use File | Settings | File Templates.
          }

          @Override
          public void popupMenuCanceled(PopupMenuEvent e) {
            // To change body of implemented methods use File | Settings | File Templates.
          }
        });

    lblBote = new JLabel("波特率");
    cmbBote = new JComboBox();
    cmbBote.addItem(9600);
    cmbBote.addItem(19200);
    cmbBote.addItem(57600);
    cmbBote.addItem(115200);

    lblLength = new JLabel("数据长度");
    cmbLength = new JComboBox();
    cmbLength.addItem(8);
    cmbLength.addItem(7);

    lblParity = new JLabel("校验");
    cmbParity = new JComboBox();
    cmbParity.addItem("None");
    cmbParity.addItem("Odd");
    cmbParity.addItem("Even");

    lblStopBit = new JLabel("停止位");
    cmbStopBit = new JComboBox();
    cmbStopBit.addItem(1);
    cmbStopBit.addItem(2);

    lblDelay = new JLabel("刷新");
    txtDelay = new JTextField(20);

    btnOk = new JButton("确定");
    btnOk.addActionListener(
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            paramIp = txtIp.getText().toString();
            paramName = txtProjectName.getSelectedItem().toString();
            paramNo = cmbNo.getSelectedItem().toString();
            paramBote = Integer.parseInt(cmbBote.getSelectedItem().toString());
            parmLength = Integer.parseInt(cmbLength.getSelectedItem().toString());
            parmParity = cmbParity.getSelectedIndex();
            parmStopBit = Integer.parseInt(cmbStopBit.getSelectedItem().toString());
            parmDelay = Integer.parseInt(txtDelay.getText().toString());

            if (!paramName.equals("") && !paramNo.equals("")) {
              receiveData(
                  paramIp,
                  paramName,
                  paramNo,
                  paramBote,
                  parmLength,
                  parmParity,
                  parmStopBit,
                  parmDelay);
            } else {

            }
          }
        });
    btnCancel = new JButton("取消");
    btnCancel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });

    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(9, 2));

    p1.add(lblIP);
    p1.add(txtIp);

    p1.add(lblNo);
    p1.add(cmbNo);

    p1.add(lblName);
    p1.add(txtProjectName);

    p1.add(lblBote);
    p1.add(cmbBote);

    p1.add(lblLength);
    p1.add(cmbLength);

    p1.add(lblParity);
    p1.add(cmbParity);

    p1.add(lblStopBit);
    p1.add(cmbStopBit);

    p1.add(lblDelay);
    p1.add(txtDelay);
    txtDelay.setText("500");

    p1.add(btnOk);
    p1.add(btnCancel);

    p1.validate();

    f.add(p1);
    f.validate();
  }
コード例 #19
0
ファイル: SceneLayoutApp.java プロジェクト: jnorthrup/scene
  public SceneLayoutApp() {
    super();
    new Pair();
    final JFrame frame = new JFrame("Scene Layout");

    final JPanel panel = new JPanel(new BorderLayout());
    frame.setContentPane(panel);
    final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setMaximumSize(screenSize);
    frame.setSize(screenSize);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final JMenuBar mb = new JMenuBar();
    frame.setJMenuBar(mb);

    final JMenu jMenu = new JMenu("File");
    mb.add(jMenu);
    mb.add(new JMenu("Edit"));
    mb.add(new JMenu("Help"));
    JMenu menu = new JMenu("Look and Feel");

    //
    // Get all the available look and feel that we are going to use for
    // creating the JMenuItem and assign the action listener to handle
    // the selection of menu item to change the look and feel.
    //
    UIManager.LookAndFeelInfo[] lookAndFeelInfos = UIManager.getInstalledLookAndFeels();
    for (int i = 0; i < lookAndFeelInfos.length; i++) {
      final UIManager.LookAndFeelInfo lookAndFeelInfo = lookAndFeelInfos[i];
      JMenuItem item = new JMenuItem(lookAndFeelInfo.getName());
      item.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              try {
                //
                // Set the look and feel for the frame and update the UI
                // to use a new selected look and feel.
                //
                UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
                SwingUtilities.updateComponentTreeUI(frame);
              } catch (ClassNotFoundException e1) {
                e1.printStackTrace();
              } catch (InstantiationException e1) {
                e1.printStackTrace();
              } catch (IllegalAccessException e1) {
                e1.printStackTrace();
              } catch (UnsupportedLookAndFeelException e1) {
                e1.printStackTrace();
              }
            }
          });
      menu.add(item);
    }

    mb.add(menu);
    jMenu.add(new JMenuItem(new scene.action.QuitAction()));

    panel.add(new JScrollPane(desktopPane), BorderLayout.CENTER);
    final JToolBar bar = new JToolBar();

    panel.add(bar, BorderLayout.NORTH);

    final JComboBox comboNewWindow =
        new JComboBox(
            new String[] {"320:180", "320:240", "640:360", "640:480", "1280:720", "1920:1080"});

    comboNewWindow.addActionListener(new CreateSceneWindowAction());

    comboNewWindow.setBorder(BorderFactory.createTitledBorder("Create New Window"));
    bar.add(comboNewWindow);
    bar.add(
        new AbstractAction("Progress Bars") {

          /** Invoked when an action occurs. */
          @Override
          public void actionPerformed(ActionEvent e) {
            new ProgressBarAnimator();
          }
        });
    bar.add(
        new AbstractAction("Sliders") {

          /** Invoked when an action occurs. */
          @Override
          public void actionPerformed(ActionEvent e) {
            new SliderBarAnimator();
          }
        });

    final JCheckBox permaViz = new JCheckBox();
    permaViz.setText("Show the dump window");
    permaViz.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

    dumpWindow = new JInternalFrame("perma dump window");
    dumpWindow.setContentPane(new JScrollPane(permText));

    permaViz.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dumpWindow.setVisible(permaViz.isSelected());
          }
        });

    comboNewWindow.setMaximumSize(comboNewWindow.getPreferredSize());

    permaViz.setSelected(false);
    bar.add(new CreateWebViewV1Action());
    bar.add(new CreateWebViewV2Action());
    bar.add(permaViz);
    desktopPane.add(dumpWindow);
    dumpWindow.setSize(400, 400);
    dumpWindow.setResizable(true);
    dumpWindow.setClosable(false);
    dumpWindow.setIconifiable(false);
    final JMenuBar m = new JMenuBar();
    final JMenu cmenu = new JMenu("Create");
    m.add(cmenu);
    final JMenuItem menuItem =
        new JMenuItem(
            new AbstractAction("new") {
              @Override
              public void actionPerformed(ActionEvent e) {
                Runnable runnable =
                    new Runnable() {
                      public void run() {
                        Object[] in = (Object[]) XSTREAM.fromXML(permText.getText());

                        final JInternalFrame ff = new JInternalFrame();

                        final ScenePanel c = new ScenePanel();
                        ff.setContentPane(c);
                        desktopPane.add(ff);
                        final Dimension d = (Dimension) in[0];
                        c.setMaximumSize(d);
                        c.setPreferredSize(d);

                        ff.setSize(d.width + 50, d.height + 50);
                        ScenePanel.panes.put(c, (List<Pair<Point, ArrayList<URL>>>) in[1]);

                        c.invalidate();
                        c.repaint();

                        ff.pack();
                        ff.setClosable(true);

                        ff.setMaximizable(false);
                        ff.setIconifiable(false);
                        ff.setResizable(false);
                        ff.show();
                      }
                    };

                SwingUtilities.invokeLater(runnable);
              }
            });
    cmenu.add(menuItem);
    //        JMenuBar menuBar = new JMenuBar();

    //        getContentPane().add(menuBar);

    dumpWindow.setJMenuBar(m);
    frame.setVisible(true);
  }