protected void bypassFilterAndSetText(StyledDocument doc, String text) {
      try {
        filter.setUpdateValue(false);
        doc.remove(0, doc.getLength());
        doc.insertString(0, text, null);

      } catch (BadLocationException e) {
        java.awt.Toolkit.getDefaultToolkit().beep();
      } finally {
        filter.setUpdateValue(true);
      }
    }
    public MainFrame() {
      try {
        mainPanel.setLayout(new BorderLayout());
        mainPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9));
        mainPanel.add(outputContainer, java.awt.BorderLayout.CENTER);
        outputArea.setLineWrap(true);
        outputContainer.add(new JScrollPane(outputArea), java.awt.BorderLayout.CENTER);
        outputContainer.setBorder(new javax.swing.border.TitledBorder("Results"));

        this.getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER);

        java.util.ArrayList<JButton> btns = new java.util.ArrayList<JButton>();
        {
          JPanel westPanel = new JPanel(new GridLayout(0, 1, 0, 10));
          westPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9));
          JPanel opsPanel = new JPanel(new GridLayout(6, 1));
          opsPanel.setBorder(new javax.swing.border.TitledBorder("Operations"));

          for (Action action : operations) {
            JPanel p = new JPanel(new BorderLayout());
            JButton jb = new JButton(action);
            btns.add(jb);
            p.add(jb, BorderLayout.NORTH);
            opsPanel.add(p);
          }

          westPanel.add(opsPanel);
          controlContainer.add(westPanel, BorderLayout.CENTER);
        }

        this.getContentPane().add(controlContainer, BorderLayout.WEST);
        this.pack();

        Dimension dim = btns.get(0).getSize();
        for (JButton btn : btns) {
          btn.setPreferredSize(dim);
        }

        java.awt.Dimension prefSize = this.getPreferredSize();
        prefSize.setSize(prefSize.getWidth(), 1.1 * prefSize.getHeight());
        this.setSize(prefSize);

        java.awt.Dimension parentSize;
        java.awt.Point parentLocation = new java.awt.Point(0, 0);
        parentSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        int x = parentLocation.x + (parentSize.width - prefSize.width) / 2;
        int y = parentLocation.y + (parentSize.height - prefSize.height) / 2;
        this.setLocation(x, y);
        this.setResizable(true);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Esempio n. 3
0
  public void redoAction() {
    try {
      if (undoMgr.canRedo()) {
        redoAction.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Redo"));

        setRedoItem();
      } else {
        java.awt.Toolkit.getDefaultToolkit().beep();
      }
    } catch (CannotUndoException ex) {
      ex.printStackTrace();
    }
  }
Esempio n. 4
0
  private void configureDisplay() {
    content = new MapContent();
    mapPane = new JMapPane(content);
    mapPane.setEnabled(true);
    content.setTitle("GIS APPLICATION");
    mapPane.setToolTipText("Map Area");
    this.setMapContent(content);

    // Create Buttons

    printBtn = new JButton("Print");

    refreshBtn = new JButton("Reset");
    refreshBtn.setToolTipText("Reset layout of window");

    queryBtn = new JButton("Query");

    // Main Panel
    mainPanel = new JPanel();
    Container contentPane = this.getContentPane();

    contentPane.setLayout(new BorderLayout());
    contentPane.add(mainPanel, BorderLayout.SOUTH);

    this.setTitle("GIS Application");
    this.enableToolBar(true);
    this.enableStatusBar(true);
    this.enableLayerTable(true);

    JToolBar toolbar = this.getToolBar();
    toolbar.addSeparator();
    toolbar.add(refreshBtn);
    toolbar.addSeparator();
    // toolbar.add(printBtn);
    toolbar.add(queryBtn);

    //		JButton distance = new JButton("Distance");
    //        toolbar.add(distance);
    //        distance.addActionListener(new ActionListener() {
    //
    //            public void actionPerformed(ActionEvent e) {
    //                distanceflag = true;
    //                distance_and_scalefalg = true;
    //                dis = 0.0;
    //                numberofpoint = 0;
    //                final JFrame ftemp = new JFrame("Distance");
    //                final JLabel flabel = new JLabel();
    //                String step = "To mesuare Distance between two points: \n (1)-Press Mouse Left
    // button on start point. \n (2)-Press Mouse Left button on destination point. \n (3)-For new
    // session press mouse right button.";
    //                JOptionPane.showMessageDialog(null, step);
    //                getMapPane().setCursorTool(
    //                        new CursorTool() {
    //
    //                            private int x1,px1,py1,y1,lx1,ly1,x2,y2,px2,py2;
    //							private double tempdistance;
    //							private int tnumberofpixel;
    //							private int lineincentimeter;
    //							private double scale;
    //
    //							@Override
    //                            public void onMouseClicked(MapMouseEvent ev) {
    //                                if (SwingUtilities.isLeftMouseButton(ev)) {
    //                                    if (distanceflag == true) {
    //                                        distanceflag = false;
    //                                        x1 = ev.getMapPosition().getX();
    //                                        px1 = ev.getX();
    //                                        py1 = ev.getY();
    //                                        y1 = ev.getMapPosition().getY();
    //                                        lx1 = ev.getXOnScreen();
    //                                        ly1 = ev.getYOnScreen();
    //                                    } else {
    //                                        String str;
    //                                        //JFrame ftemp=new JFrame("Distance");
    //                                        ftemp.setVisible(false);
    //                                        Graphics g = getGraphics();
    //                                        //Graphics scaleg=scalepanel.getGraphics();
    //
    //                                        g.drawLine(lx1, ly1, ev.getXOnScreen(),
    // ev.getYOnScreen());
    //                                        lx1 = ev.getXOnScreen();
    //                                        ly1 = ev.getYOnScreen();
    //                                        x2 = ev.getMapPosition().getX();
    //                                        y2 = ev.getMapPosition().getY();
    //                                        px2 = ev.getX();
    //                                        py2 = ev.getY();
    //                                        dis = dis + Math.sqrt(Math.pow(x1 - x2, 2) +
    // Math.pow(y1 - y2, 2));
    ////                                        tempdistance=dis;
    //                                        numberofpoint += Math.sqrt(Math.pow(px1 - px2, 2) +
    // Math.pow(py1 - py2, 2));
    //                                        System.out.println("numberofpoint = " +
    // numberofpoint);
    //                                        if (distance_and_scalefalg == true) {
    //                                            distance_and_scalefalg = false;
    //                                            tempdistance = dis;
    //                                            tnumberofpixel = numberofpoint;
    //                                            lineincentimeter = tnumberofpixel / 28;
    //                                            scale = tempdistance / lineincentimeter;
    //                                        }
    ////
    //                                        System.out.println("lineincentimeter = " +
    // lineincentimeter);
    //                                        x1 = ev.getMapPosition().getX();
    //                                        y1 = ev.getMapPosition().getY();
    //                                        px1 = ev.getX();
    //                                        py1 = ev.getY();
    //                                        System.out.println("x1=" + x1 + "  " + "y1=" + y1);
    //                                        System.out.println("x2=" + x2 + "  " + "y2=" + y2);
    //                                        System.out.println("distance=" + dis + " Meters");
    //                                        scalevalue.setVisible(true);
    //                                        scalevalue.setText("Scale :  1 cm = " + scale + "
    // Meters");
    //                                        toolbar.add(scalevalue, BorderLayout.EAST);
    //                                        flabel.setText("Distance = " + dis + " Meters");
    //                                        JPanel fpanel = new JPanel(new FlowLayout());
    //                                        JButton meterbtn = new JButton("Meters");
    //                                        JButton kmbtn = new JButton("KiloMeters");
    //                                        JButton milebtn = new JButton("Miles");
    //                                        JButton yardbtn = new JButton("Yards");
    //                                        meterbtn.addActionListener(new ActionListener() {
    //
    //                                            public void actionPerformed(ActionEvent e) {
    //                                                flabel.setText("Distance = " + dis + "
    // Meters");
    //                                                scalevalue.setText("Scale :  1 cm = " + scale
    // + " Meters");
    //                                            }
    //                                        });
    //
    //                                        kmbtn.addActionListener(new ActionListener() {
    //
    //                                            public void actionPerformed(ActionEvent e) {
    //                                                flabel.setText("Distance = " + dis / 1000 + "
    // KiloMeters");
    //                                                scalevalue.setText("Scale :  1 cm = " + scale
    // / 1000 + " Km");
    //                                            }
    //                                        });
    //
    //                                        milebtn.addActionListener(new ActionListener() {
    //
    //                                            public void actionPerformed(ActionEvent e) {
    //                                                flabel.setText("Distance = " + dis * 0.00062 +
    // " Miles");
    //                                                scalevalue.setText("Scale :  1 cm = " + scale
    // * 0.00062 + " Miles");
    //                                            }
    //                                        });
    //
    //
    //                                        yardbtn.addActionListener(new ActionListener() {
    //
    //                                            public void actionPerformed(ActionEvent e) {
    //                                                flabel.setText("Distance = " + dis * 1.094 + "
    // Yards");
    //                                                scalevalue.setText("Scale :  1 cm = " + scale
    // * 1.094 + " Yards");
    //                                            }
    //                                        });
    //
    //                                        fpanel.add(meterbtn);
    //                                        fpanel.add(kmbtn);
    //                                        fpanel.add(milebtn);
    //                                        fpanel.add(yardbtn);
    //                                        ftemp.add(flabel, BorderLayout.CENTER);
    //                                        ftemp.add(fpanel, BorderLayout.SOUTH);
    //                                        ftemp.setSize(400, 200);
    //                                        ftemp.setVisible(true);
    //
    //                                    }
    //                                } else {
    //                                    distanceflag = true;
    //                                    distance_and_scalefalg = true;
    //                                    scalevalue.setVisible(false);
    //                                    dis = 0.0;
    //                                    numberofpoint = 0;
    //                                    setMapContext(context);
    //                                    repaint();
    //                                }
    //                            }
    //                        });
    //            }
    //        });
    this.setJMenuBar(new CustomMenuBar(mapPane));
    this.setExtendedState(MAXIMIZED_BOTH);
    this.setMinimumSize(new Dimension(800, 800));

    this.setIconImage(java.awt.Toolkit.getDefaultToolkit().createImage("res\\img\\icon.png"));
    this.setVisible(true);
  }
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jToolBar1 = new javax.swing.JToolBar();
    jPanel1 = new javax.swing.JPanel();
    txtUserID = new javax.swing.JTextField();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    txtUserName = new javax.swing.JTextField();
    lbHour = new javax.swing.JLabel();
    lbDate = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    lbYear = new javax.swing.JLabel();
    jMenuBar1 = new javax.swing.JMenuBar();
    mnMaster = new javax.swing.JMenu();
    mnMasterTitle = new javax.swing.JMenuItem();
    mnMasterEmployee = new javax.swing.JMenuItem();
    mnMasterBudgetGroup = new javax.swing.JMenuItem();
    mnMasterBudgetDetail = new javax.swing.JMenuItem();
    mnTransaction = new javax.swing.JMenu();
    mnTransactionBeginningBalance = new javax.swing.JMenuItem();
    mnTransactionBudgetUsage = new javax.swing.JMenuItem();
    mnTransactionBudgetTransfer = new javax.swing.JMenuItem();
    mnTransactionEndofYear = new javax.swing.JMenuItem();
    mnLaporan = new javax.swing.JMenu();
    mnRptMasterBudget = new javax.swing.JMenuItem();
    mnRptBudgetUsage = new javax.swing.JMenuItem();
    mnRptTrxBudgetUsage = new javax.swing.JMenuItem();
    mnRptTrxBudgetTransfer = new javax.swing.JMenuItem();
    mnUser = new javax.swing.JMenu();
    mnMasterUser = new javax.swing.JMenuItem();
    mnUserFunction = new javax.swing.JMenuItem();
    mnChangePassword = new javax.swing.JMenuItem();
    mnExit = new javax.swing.JMenu();
    mnLogOff = new javax.swing.JMenuItem();
    mnExitExit = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("OPC Budget Controlling Program");
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            FrmMainMenu.this.windowClosing(evt);
          }
        });

    jToolBar1.setRollover(true);

    jPanel1.setBackground(new java.awt.Color(255, 51, 51));

    txtUserID.setBackground(new java.awt.Color(204, 255, 204));
    txtUserID.setFont(new java.awt.Font("Tahoma", 1, 12));
    txtUserID.setDisabledTextColor(new java.awt.Color(255, 51, 51));
    txtUserID.setEnabled(false);

    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel1.setText("User ID");

    jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel2.setText("User Name");

    txtUserName.setBackground(new java.awt.Color(204, 255, 204));
    txtUserName.setFont(new java.awt.Font("Tahoma", 1, 12));
    txtUserName.setDisabledTextColor(new java.awt.Color(255, 51, 51));
    txtUserName.setEnabled(false);

    lbHour.setBackground(new java.awt.Color(51, 51, 255));
    lbHour.setFont(new java.awt.Font("Tahoma", 1, 12));
    lbHour.setForeground(new java.awt.Color(51, 255, 51));

    lbDate.setBackground(new java.awt.Color(51, 51, 255));
    lbDate.setFont(new java.awt.Font("Tahoma", 1, 12));
    lbDate.setForeground(new java.awt.Color(51, 255, 51));

    jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12));
    jLabel3.setText("Budget Year");

    lbYear.setBackground(new java.awt.Color(51, 51, 255));
    lbYear.setFont(new java.awt.Font("Tahoma", 1, 12));
    lbYear.setForeground(new java.awt.Color(51, 255, 51));

    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel1Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .add(jLabel1)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        txtUserID,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        123,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(18, 18, 18)
                    .add(
                        jLabel2,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(
                        txtUserName,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        133,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(26, 26, 26)
                    .add(
                        lbDate,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        123,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                    .add(
                        lbHour,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        85,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(75, 75, 75)
                    .add(
                        jLabel3,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                    .add(
                        lbYear,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        62,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(50, 50, 50)));
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                jPanel1Layout
                    .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(
                        txtUserID,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel1)
                    .add(
                        txtUserName,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel2)
                    .add(
                        lbDate,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        20,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(
                        lbHour,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        20,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(
                        lbYear,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        20,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel3)));

    jToolBar1.add(jPanel1);

    mnMaster.setBackground(new java.awt.Color(204, 255, 255));
    mnMaster.setText("Master");
    mnMaster.setFont(new java.awt.Font("Tahoma", 1, 12));

    mnMasterTitle.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
    mnMasterTitle.setBackground(new java.awt.Color(255, 255, 204));
    mnMasterTitle.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnMasterTitle.setText("Title");
    mnMasterTitle.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnMasterTitleActionPerformed(evt);
          }
        });
    mnMaster.add(mnMasterTitle);

    mnMasterEmployee.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_Y, java.awt.event.InputEvent.CTRL_MASK));
    mnMasterEmployee.setBackground(new java.awt.Color(255, 255, 204));
    mnMasterEmployee.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnMasterEmployee.setText("Employee");
    mnMasterEmployee.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnMasterEmployeeActionPerformed(evt);
          }
        });
    mnMaster.add(mnMasterEmployee);

    mnMasterBudgetGroup.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.CTRL_MASK));
    mnMasterBudgetGroup.setBackground(new java.awt.Color(255, 255, 204));
    mnMasterBudgetGroup.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnMasterBudgetGroup.setText("Budget Group");
    mnMasterBudgetGroup.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnMasterBudgetGroupActionPerformed(evt);
          }
        });
    mnMaster.add(mnMasterBudgetGroup);

    mnMasterBudgetDetail.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
    mnMasterBudgetDetail.setBackground(new java.awt.Color(255, 255, 204));
    mnMasterBudgetDetail.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnMasterBudgetDetail.setText("Budget Detail");
    mnMasterBudgetDetail.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnMasterBudgetDetailActionPerformed(evt);
          }
        });
    mnMaster.add(mnMasterBudgetDetail);

    jMenuBar1.add(mnMaster);

    mnTransaction.setBackground(new java.awt.Color(204, 255, 255));
    mnTransaction.setText("Transaction");
    mnTransaction.setFont(new java.awt.Font("Tahoma", 1, 12));

    mnTransactionBeginningBalance.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
    mnTransactionBeginningBalance.setBackground(new java.awt.Color(255, 255, 204));
    mnTransactionBeginningBalance.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnTransactionBeginningBalance.setText("Beginning Balance");
    mnTransactionBeginningBalance.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnTransactionBeginningBalanceActionPerformed(evt);
          }
        });
    mnTransaction.add(mnTransactionBeginningBalance);

    mnTransactionBudgetUsage.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
    mnTransactionBudgetUsage.setBackground(new java.awt.Color(255, 255, 204));
    mnTransactionBudgetUsage.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnTransactionBudgetUsage.setText("Budget Usage");
    mnTransactionBudgetUsage.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnTransactionBudgetUsageActionPerformed(evt);
          }
        });
    mnTransaction.add(mnTransactionBudgetUsage);

    mnTransactionBudgetTransfer.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.CTRL_MASK));
    mnTransactionBudgetTransfer.setBackground(new java.awt.Color(255, 255, 204));
    mnTransactionBudgetTransfer.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnTransactionBudgetTransfer.setText("Budget Transfer");
    mnTransactionBudgetTransfer.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnTransactionBudgetTransferActionPerformed(evt);
          }
        });
    mnTransaction.add(mnTransactionBudgetTransfer);

    mnTransactionEndofYear.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK));
    mnTransactionEndofYear.setBackground(new java.awt.Color(255, 255, 204));
    mnTransactionEndofYear.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnTransactionEndofYear.setText("End of Year");
    mnTransactionEndofYear.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnTransactionEndofYearActionPerformed(evt);
          }
        });
    mnTransaction.add(mnTransactionEndofYear);

    jMenuBar1.add(mnTransaction);

    mnLaporan.setBackground(new java.awt.Color(204, 255, 255));
    mnLaporan.setText("Report");
    mnLaporan.setFont(new java.awt.Font("Tahoma", 1, 12));

    mnRptMasterBudget.setBackground(new java.awt.Color(255, 255, 204));
    mnRptMasterBudget.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnRptMasterBudget.setText("Master Budget");
    mnRptMasterBudget.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnRptMasterBudgetActionPerformed(evt);
          }
        });
    mnLaporan.add(mnRptMasterBudget);

    mnRptBudgetUsage.setBackground(new java.awt.Color(255, 255, 204));
    mnRptBudgetUsage.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnRptBudgetUsage.setText("Budget Detail Per Month");
    mnRptBudgetUsage.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnRptBudgetUsageActionPerformed(evt);
          }
        });
    mnLaporan.add(mnRptBudgetUsage);

    mnRptTrxBudgetUsage.setBackground(new java.awt.Color(255, 255, 204));
    mnRptTrxBudgetUsage.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnRptTrxBudgetUsage.setText("Trx. Budget Usage");
    mnRptTrxBudgetUsage.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnRptTrxBudgetUsageActionPerformed(evt);
          }
        });
    mnLaporan.add(mnRptTrxBudgetUsage);

    mnRptTrxBudgetTransfer.setBackground(new java.awt.Color(255, 255, 204));
    mnRptTrxBudgetTransfer.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnRptTrxBudgetTransfer.setText("Trx. Budget Transfer");
    mnRptTrxBudgetTransfer.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnRptTrxBudgetTransferActionPerformed(evt);
          }
        });
    mnLaporan.add(mnRptTrxBudgetTransfer);

    jMenuBar1.add(mnLaporan);

    mnUser.setBackground(new java.awt.Color(204, 255, 255));
    mnUser.setText("Users Management");
    mnUser.setFont(new java.awt.Font("Tahoma", 1, 12));

    mnMasterUser.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_F5, java.awt.event.InputEvent.CTRL_MASK));
    mnMasterUser.setBackground(new java.awt.Color(255, 255, 204));
    mnMasterUser.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnMasterUser.setText("User");
    mnMasterUser.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnMasterUserActionPerformed(evt);
          }
        });
    mnUser.add(mnMasterUser);

    mnUserFunction.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_F6, java.awt.event.InputEvent.CTRL_MASK));
    mnUserFunction.setBackground(new java.awt.Color(255, 255, 204));
    mnUserFunction.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnUserFunction.setText("User Functions");
    mnUserFunction.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnUserFunctionActionPerformed(evt);
          }
        });
    mnUser.add(mnUserFunction);

    mnChangePassword.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_F7, java.awt.event.InputEvent.CTRL_MASK));
    mnChangePassword.setBackground(new java.awt.Color(255, 255, 204));
    mnChangePassword.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnChangePassword.setText("Change Password");
    mnChangePassword.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnChangePasswordActionPerformed(evt);
          }
        });
    mnUser.add(mnChangePassword);

    jMenuBar1.add(mnUser);

    mnExit.setBackground(new java.awt.Color(204, 255, 255));
    mnExit.setText("Exit");
    mnExit.setFont(new java.awt.Font("Tahoma", 1, 12));

    mnLogOff.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
    mnLogOff.setBackground(new java.awt.Color(255, 255, 204));
    mnLogOff.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnLogOff.setText("Log Off");
    mnLogOff.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnLogOffActionPerformed(evt);
          }
        });
    mnExit.add(mnLogOff);

    mnExitExit.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
    mnExitExit.setBackground(new java.awt.Color(255, 255, 204));
    mnExitExit.setFont(new java.awt.Font("Tahoma", 1, 12));
    mnExitExit.setText("Exit");
    mnExitExit.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnExitExitActionPerformed(evt);
          }
        });
    mnExit.add(mnExitExit);

    jMenuBar1.add(mnExit);

    setJMenuBar(jMenuBar1);

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jToolBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 925, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .add(
                        jToolBar1,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
                        25,
                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(649, Short.MAX_VALUE)));

    pack();
    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    java.awt.Dimension dialogSize = getSize();
    setLocation(
        (screenSize.width - dialogSize.width) / 2, (screenSize.height - dialogSize.height) / 2);
  } // </editor-fold>//GEN-END:initComponents
Esempio n. 6
0
  /** @param arg */
  public static void main(String arg[]) {
    TestApp af = new TestApp();

    SourceImage sImg = null;

    int imagesPerRow = 0;
    int imagesPerCol = 0;

    int imgMin = 65536;
    int imgMax = 0;

    boolean signed = false;
    boolean inverted = false;
    boolean hasPad = false;
    int padValue = 0;

    if (arg.length == 6) {
      // do it with raw file
      int w = 0;
      int h = 0;
      int d = 0;
      try {
        w = Integer.valueOf(arg[1]).intValue();
        h = Integer.valueOf(arg[2]).intValue();
        d = Integer.valueOf(arg[3]).intValue();
        imagesPerRow = Integer.valueOf(arg[4]).intValue();
        imagesPerCol = Integer.valueOf(arg[5]).intValue();
      } catch (Exception e) {
        System.err.println(e);
        System.exit(0);
      }

      try {
        FileInputStream i = new FileInputStream(arg[0]);
        sImg = new SourceImage(i, w, h, d);
      } catch (Exception e) {
        System.err.println(e);
        System.exit(0);
      }
    } else {
      // do it with DICOM file

      if (arg.length > 2) {
        try {
          imagesPerRow = Integer.valueOf(arg[1]).intValue();
          imagesPerCol = Integer.valueOf(arg[2]).intValue();
        } catch (Exception e) {
          System.err.println(e);
          e.printStackTrace(System.err);
          System.exit(0);
        }
      } else {
        imagesPerRow = 1;
        imagesPerCol = 1;
      }

      try {
        DicomInputStream i = new DicomInputStream(new FileInputStream(arg[0]));
        sImg = new SourceImage(i);
      } catch (Exception e) {
        System.err.println(e);
        e.printStackTrace(System.err);
        System.exit(0);
      }
    }

    try {
      // com.apple.cocoa.application.NSMenu.setMenuBarVisible(false);							// Won't compile on
      // other platforms
      // Class classToUse =
      // ClassLoader.getSystemClassLoader().loadClass("com.apple.cocoa.application.NSMenu");	//
      // Needs "/System/Library/Java" in classpath
      Class classToUse =
          new java.net.URLClassLoader(new java.net.URL[] {new File("/System/Library/Java").toURL()})
              .loadClass("com.apple.cocoa.application.NSMenu");
      Class[] parameterTypes = {Boolean.TYPE};
      java.lang.reflect.Method methodToUse =
          classToUse.getDeclaredMethod("setMenuBarVisible", parameterTypes);
      Object[] args = {Boolean.FALSE};
      methodToUse.invoke(null /*since static*/, args);
    } catch (Exception e) { // ClassNotFoundException,NoSuchMethodException,IllegalAccessException
      e.printStackTrace(System.err);
    }

    java.awt.Dimension d = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    int frameWidth = (int) d.getWidth();
    int frameHeight = (int) d.getHeight();
    System.err.println("frameWidth=" + frameWidth);
    System.err.println("frameHeight=" + frameHeight);
    af.setUndecorated(true);
    af.setLocation(0, 0);
    af.setSize(frameWidth, frameHeight);

    JPanel multiPanel = new JPanel();
    multiPanel.setLayout(new GridLayout(imagesPerCol, imagesPerRow));
    multiPanel.setBackground(Color.black);

    SingleImagePanel imagePanel[] = new SingleImagePanel[imagesPerRow * imagesPerCol];

    int singleWidth = frameWidth / imagesPerRow;
    int singleHeight = frameHeight / imagesPerCol;
    System.err.println("singleWidth=" + singleWidth);
    System.err.println("singleHeight=" + singleHeight);

    for (int x = 0; x < imagesPerCol; ++x) {
      for (int y = 0; y < imagesPerRow; ++y) {
        SingleImagePanel ip = new SingleImagePanel(sImg);
        // ip.setPreferredSize(new Dimension(img.getWidth(),img.getHeight()));
        // ip.setPreferredSize(new Dimension(sImg.getWidth(),sImg.getHeight()));
        ip.setPreferredSize(new Dimension(singleWidth, singleHeight));
        multiPanel.add(ip);
        imagePanel[x * imagesPerRow + y] = ip;
      }
    }

    // multiPanel.setSize(img.getWidth()*imagesPerRow,img.getHeight()*imagesPerRow);

    // JScrollPane scrollPane = new JScrollPane(multiPanel);

    Container content = af.getContentPane();
    content.setLayout(new GridLayout(1, 1));
    // content.add(scrollPane);
    content.add(multiPanel);

    af.pack();
    af.setVisible(true);
  }