SwingProgress() {
      super(new BorderLayout());

      progress = new JProgressBar();
      progress.setStringPainted(true);

      SwingProgress.this.add(BorderLayout.NORTH, progress);
    }
Exemple #2
0
  private JPanel getContentPanel() {

    JPanel contentPanel1 = new JPanel();

    connectorGroup = new ButtonGroup();
    welcomeTitle = new JLabel();
    jPanel1 = new JPanel();
    blankSpace = new JLabel();
    progressSent = new JProgressBar();
    progressDescription = new JLabel();
    anotherBlankSpace = new JLabel();
    yetAnotherBlankSpace1 = new JLabel();
    jLabel1 = new JLabel();

    contentPanel1.setLayout(new java.awt.BorderLayout());

    welcomeTitle.setText("Now we will pretend to send this data somewhere for approval...");
    contentPanel1.add(welcomeTitle, java.awt.BorderLayout.NORTH);

    jPanel1.setLayout(new java.awt.GridLayout(0, 1));

    jPanel1.add(blankSpace);

    progressSent.setStringPainted(true);
    jPanel1.add(progressSent);

    progressDescription.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
    progressDescription.setText("Connecting to Server...");
    jPanel1.add(progressDescription);

    jPanel1.add(anotherBlankSpace);

    jPanel1.add(yetAnotherBlankSpace1);

    contentPanel1.add(jPanel1, java.awt.BorderLayout.CENTER);

    jLabel1.setText(
        "After the sending is completed, the Back and Finish buttons will enable below.");
    contentPanel1.add(jLabel1, java.awt.BorderLayout.SOUTH);

    return contentPanel1;
  }
Exemple #3
0
  private JPanel makeProgressBar() {
    JPanel panel = new JPanel();

    myProgress = new BoggleProgress(0, myGameLength);
    myProgress.setStringPainted(true);
    myTimer =
        new javax.swing.Timer(
            1000,
            new ActionListener() {

              public void actionPerformed(ActionEvent arg0) {
                mySeconds++;
                myProgress.setValue(mySeconds);
                if (mySeconds > myGameLength) {
                  gameOver();
                }
              }
            });
    panel.add(myProgress);
    return panel;
  }
Exemple #4
0
  /**
   * Create a new, empty, not-visible TaxRef window. Really just activates the setup frame and setup
   * memory monitor components, then starts things off.
   */
  public MainFrame() {
    setupMemoryMonitor();

    // Set up the main frame.
    mainFrame = new JFrame(basicTitle);
    mainFrame.setJMenuBar(setupMenuBar());
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Set up the JTable.
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setSelectionBackground(COLOR_SELECTION_BACKGROUND);
    table.setShowGrid(true);

    // Add a blank table model so that the component renders properly on
    // startup.
    table.setModel(blankDataModel);

    // Add a list selection listener so we can tell the matchInfoPanel
    // that a new name was selected.
    table
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              @Override
              public void valueChanged(ListSelectionEvent e) {
                if (currentCSV == null) return;

                int row = table.getSelectedRow();
                int column = table.getSelectedColumn();

                columnInfoPanel.columnChanged(column);

                Object o = table.getModel().getValueAt(row, column);
                if (Name.class.isAssignableFrom(o.getClass())) {
                  matchInfoPanel.nameSelected(currentCSV.getRowIndex(), (Name) o, row, column);
                } else {
                  matchInfoPanel.nameSelected(currentCSV.getRowIndex(), null, -1, -1);
                }
              }
            });

    // Set up the left panel (table + matchInfoPanel)
    JPanel leftPanel = new JPanel();

    matchInfoPanel = new MatchInformationPanel(this);
    leftPanel.setLayout(new BorderLayout());
    leftPanel.add(matchInfoPanel, BorderLayout.SOUTH);
    leftPanel.add(new JScrollPane(table));

    // Set up the right panel (columnInfoPanel)
    JPanel rightPanel = new JPanel();

    columnInfoPanel = new ColumnInformationPanel(this);

    progressBar.setStringPainted(true);

    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(columnInfoPanel);
    rightPanel.add(progressBar, BorderLayout.SOUTH);

    // Set up a JSplitPane to split the panels up.
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, leftPanel, rightPanel);
    split.setResizeWeight(1);
    mainFrame.add(split);
    mainFrame.pack();

    // Set up a drop target so we can pick up files
    mainFrame.setDropTarget(
        new DropTarget(
            mainFrame,
            new DropTargetAdapter() {
              @Override
              public void dragEnter(DropTargetDragEvent dtde) {
                // Accept any drags.
                dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
              }

              @Override
              public void dragOver(DropTargetDragEvent dtde) {}

              @Override
              public void dropActionChanged(DropTargetDragEvent dtde) {}

              @Override
              public void dragExit(DropTargetEvent dte) {}

              @Override
              public void drop(DropTargetDropEvent dtde) {
                // Accept a drop as long as its File List.

                if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
                  dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);

                  Transferable t = dtde.getTransferable();

                  try {
                    java.util.List<File> files =
                        (java.util.List<File>) t.getTransferData(DataFlavor.javaFileListFlavor);

                    // If we're given multiple files, pick up only the last file and load that.
                    File f = files.get(files.size() - 1);
                    loadFile(f, DarwinCSV.FILE_CSV_DELIMITED);

                  } catch (UnsupportedFlavorException ex) {
                    dtde.dropComplete(false);

                  } catch (IOException ex) {
                    dtde.dropComplete(false);
                  }
                }
              }
            }));
  }