/** Initialize the panel containing the node. */
  public PluginListCellRenderer() {
    super(new BorderLayout(8, 8));

    JPanel mainPanel = new JPanel(new BorderLayout());

    this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    this.setBackground(Color.WHITE);

    this.setOpaque(true);

    mainPanel.setOpaque(false);
    this.nameVersionPanel.setOpaque(false);

    this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    this.nameLabel.setIconTextGap(2);

    this.nameLabel.setFont(this.getFont().deriveFont(Font.BOLD));
    this.systemLabel.setFont(this.getFont().deriveFont(Font.BOLD));

    this.nameVersionPanel.add(nameLabel);
    this.nameVersionPanel.add(versionLabel);

    mainPanel.add(nameVersionPanel, BorderLayout.NORTH);
    mainPanel.add(descriptionLabel, BorderLayout.CENTER);

    this.add(iconLabel, BorderLayout.WEST);

    this.add(mainPanel, BorderLayout.CENTER);
    this.add(stateLabel, BorderLayout.WEST);
  }
  public FileNameRenderer(JTable table) {
    Border b = UIManager.getBorder("Table.noFocusBorder");
    if (Objects.isNull(b)) { // Nimbus???
      Insets i = focusCellHighlightBorder.getBorderInsets(textLabel);
      b = BorderFactory.createEmptyBorder(i.top, i.left, i.bottom, i.right);
    }
    noFocusBorder = b;

    p.setOpaque(false);
    panel.setOpaque(false);

    // http://www.icongalore.com/ XP Style Icons - Windows Application Icon, Software XP Icons
    nicon = new ImageIcon(getClass().getResource("wi0063-16.png"));
    sicon =
        new ImageIcon(
            p.createImage(
                new FilteredImageSource(nicon.getImage().getSource(), new SelectedImageFilter())));

    iconLabel = new JLabel(nicon);
    iconLabel.setBorder(BorderFactory.createEmptyBorder());

    p.add(iconLabel, BorderLayout.WEST);
    p.add(textLabel);
    panel.add(p, BorderLayout.WEST);

    Dimension d = iconLabel.getPreferredSize();
    dim.setSize(d);
    table.setRowHeight(d.height);
  }
 /** Show the filter dialog */
 public void showDialog() {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   include_panel =
       new ServiceFilterPanel("Include messages based on target service:", filter_include_list);
   exclude_panel =
       new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list);
   status_box = new JCheckBox("Filter messages based on status:");
   status_box.addActionListener(this);
   status_active = new JRadioButton("Active messages only");
   status_active.setSelected(true);
   status_active.setEnabled(false);
   status_complete = new JRadioButton("Complete messages only");
   status_complete.setEnabled(false);
   status_group = new ButtonGroup();
   status_group.add(status_active);
   status_group.add(status_complete);
   if (filter_active || filter_complete) {
     status_box.setSelected(true);
     status_active.setEnabled(true);
     status_complete.setEnabled(true);
     if (filter_complete) {
       status_complete.setSelected(true);
     }
   }
   status_options = new JPanel();
   status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS));
   status_options.add(status_active);
   status_options.add(status_complete);
   status_options.setBorder(indent_border);
   status_panel = new JPanel();
   status_panel.setLayout(new BorderLayout());
   status_panel.add(status_box, BorderLayout.NORTH);
   status_panel.add(status_options, BorderLayout.CENTER);
   status_panel.setBorder(empty_border);
   ok_button = new JButton("Ok");
   ok_button.addActionListener(this);
   cancel_button = new JButton("Cancel");
   cancel_button.addActionListener(this);
   buttons = new JPanel();
   buttons.setLayout(new FlowLayout());
   buttons.add(ok_button);
   buttons.add(cancel_button);
   panel = new JPanel();
   panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
   panel.add(include_panel);
   panel.add(exclude_panel);
   panel.add(status_panel);
   panel.add(buttons);
   dialog = new JDialog();
   dialog.setTitle("SOAP Monitor Filter");
   dialog.setContentPane(panel);
   dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   dialog.setModal(true);
   dialog.pack();
   Dimension d = dialog.getToolkit().getScreenSize();
   dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2);
   ok_pressed = false;
   dialog.show();
 }
Beispiel #4
0
  private JComponent createForm() {
    JPanel panel = new JPanel();
    panel.setLayout(new MigLayout());
    titleData = new JPanel();
    titleData.setLayout(new MigLayout("insets 0", "[grow]"));
    titleData.setBorder(BorderFactory.createTitledBorder(""));

    txtRoomNumber = new JTextField();
    txtDescription = new JTextArea();
    boxRoomStatusID = new JComboBox();
    boxRoomTypeID = new JComboBox();

    titleData.add(new JLabel("Room Number"), "right");
    titleData.add(txtRoomNumber, "grow,width max,height 22,span,gap top 4,gap bottom 4");

    titleData.add(new JLabel("RoomType"), "right");
    titleData.add(boxRoomTypeID, "grow,width max,height 22,span,gap top 4,gap bottom 4");

    titleData.add(new JLabel("RoomStatus"), "right");
    titleData.add(boxRoomStatusID, "grow,width max,height 22,span,gap top 4,gap bottom 4");

    titleData.add(new JLabel("Description"), "right");
    titleData.add(txtDescription, "grow,width max,height 150,span,gap top 4,gap bottom 4");

    panel.add(titleData, "span,width max,height 355");
    return panel;
  }
Beispiel #5
0
    ThreadHeaderRenderer(int modelCol) {
      super(modelCol);

      sort = new JPanel(new BorderLayout());
      sort.setBorder(new BevelBorder(BevelBorder.RAISED));
      sort.add(new JLabel(threadSortIcon), BorderLayout.CENTER);

      unsort = new JPanel(new BorderLayout());
      unsort.setBorder(new BevelBorder(BevelBorder.RAISED));
      unsort.add(new JLabel(threadUnSortIcon), BorderLayout.CENTER);

      comp = unsort;
    }
 // --------初始化界面的方法---------
 public void init() {
   JPanel top = new JPanel();
   top.add(new JLabel("输入查询语句:"));
   top.add(sqlField);
   top.add(execBn);
   // 为执行按钮、单行文本框添加事件监听器
   execBn.addActionListener(new ExceListener());
   sqlField.addActionListener(new ExceListener());
   jf.add(top, BorderLayout.NORTH);
   jf.setSize(680, 480);
   jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   jf.setVisible(true);
 }
Beispiel #7
0
  @SuppressWarnings("unchecked")
  private JComponent jRoom() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder(""));
    scrollPane = new JScrollPane();
    jRoom = new JTable();
    tableTitle.add("RoomID");
    tableTitle.add("RoomNumber");
    tableTitle.add("RoomType");
    tableTitle.add("NumBeds");
    tableTitle.add("RoomTypeRate");
    tableTitle.add("RoomStatus");
    tableTitle.add("Description");

    model =
        new DefaultTableModel(tableRecords, tableTitle) {
          private static final long serialVersionUID = 1L;

          public boolean isCellEditable(int rowIndex, int mColIndex) {
            return false;
          }
        };

    jRoom.setModel(model);
    jRoom.getTableHeader().setReorderingAllowed(false);
    scrollPane.setViewportView(jRoom);
    panel.add(scrollPane);

    return panel;
  }
 {
   for (myjava.gui.syntax.Painter painter : myjava.gui.syntax.Painter.getPainters()) {
     painterComboBox.addItem(painter);
     EntryListPanel panel = new EntryListPanel(painter);
     listPanelSet.add(panel);
     centerPanel.add(panel, painter.getName());
   }
   componentSet.addAll(Arrays.asList(matchBracket, painterComboBox, centerPanel));
 }
Beispiel #9
0
    void setSortCol(int sortCol, boolean reverse) {
      if (sortCol == modelCol) {

        if (!hasSortIndicator) compPanel.add(reverse ? upLabel : downLabel, BorderLayout.EAST);
        else if (reverse != this.reverse) {
          compPanel.remove(1);
          compPanel.add(reverse ? upLabel : downLabel, BorderLayout.EAST);
        }

        this.reverse = reverse;
        hasSortIndicator = true;

        // System.out.println("setSortCol on "+modelCol+" "+sortCol+" "+reverse);
      } else if (hasSortIndicator) {
        compPanel.remove(1);
        hasSortIndicator = false;
        // System.out.println("setSortCol off "+modelCol+" "+sortCol+" "+reverse);
      }
    }
Beispiel #10
0
    SortedHeaderRenderer(String name, int modelCol) {
      this.modelCol = modelCol;
      upLabel = new JLabel(sortUpIcon);
      downLabel = new JLabel(sortDownIcon);

      compPanel = new JPanel(new BorderLayout());
      compPanel.setBorder(new BevelBorder(BevelBorder.RAISED));
      compPanel.add(new JLabel(name), BorderLayout.CENTER);
      comp = compPanel;
    }
 /** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user pressed the remove button
   if (e.getSource() == remove_button) {
     int row = table.getSelectedRow();
     model.removeRow(row);
     table.clearSelection();
     table.repaint();
     valueChanged(null);
   }
   // Check if the user pressed the remove all button
   if (e.getSource() == remove_all_button) {
     model.clearAll();
     table.setRowSelectionInterval(0, 0);
     table.repaint();
     valueChanged(null);
   }
   // Check if the user pressed the filter button
   if (e.getSource() == filter_button) {
     filter.showDialog();
     if (filter.okPressed()) {
       // Update the display with new filter
       model.setFilter(filter);
       table.repaint();
     }
   }
   // Check if the user pressed the start button
   if (e.getSource() == start_button) {
     start();
   }
   // Check if the user pressed the stop button
   if (e.getSource() == stop_button) {
     stop();
   }
   // Check if the user wants to switch layout
   if (e.getSource() == layout_button) {
     details_panel.remove(details_soap);
     details_soap.removeAll();
     if (details_soap.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
       details_soap = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
     } else {
       details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
     }
     details_soap.setTopComponent(request_panel);
     details_soap.setRightComponent(response_panel);
     details_soap.setResizeWeight(.5);
     details_panel.add(details_soap, BorderLayout.CENTER);
     details_panel.validate();
     details_panel.repaint();
   }
   // Check if the user is changing the reflow option
   if (e.getSource() == reflow_xml) {
     request_text.setReflowXML(reflow_xml.isSelected());
     response_text.setReflowXML(reflow_xml.isSelected());
   }
 }
Beispiel #12
0
  public EmpMain() {
    String[] col = {"사번", "이름", "직위", "입사일", "부서번호"};
    String[][] row = new String[0][5];
    model =
        new DefaultTableModel(row, col) {
          public boolean isCellEditable(int r, int c) {
            return false;
          }
        };
    table = new JTable(model);
    JScrollPane js = new JScrollPane(table);
    la = new JLabel("사원목록");
    la.setFont(new Font("나눔스퀘어", Font.BOLD, 30));
    table.setFont(new Font("나눔스퀘어", Font.PLAIN, 12));
    JPanel p = new JPanel();
    p.add(la);

    la1 = new JLabel("Search");
    tf = new JTextField(10);
    box = new JComboBox();
    box.addItem("이름");
    box.addItem("입사일");
    box.addItem("부서");
    b1 = new JButton("찾기");
    b2 = new JButton("목록");
    JPanel p1 = new JPanel();
    p1.add(la1);
    p1.add(box);
    p1.add(tf);
    p1.add(b1);
    p1.add(b2);
    add("South", p1);
    add("Center", js);
    add("North", p);
    setSize(640, 480);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    getData();
    table.addMouseListener(this);
    b1.addActionListener(this);
    b2.addActionListener(this);
  }
Beispiel #13
0
 private void addPainter(myjava.gui.syntax.Painter painter) {
   EntryListPanel newPanel = new EntryListPanel(painter);
   listPanelSet.add(newPanel);
   centerPanel.add(newPanel, painter.getName());
   painterComboBox.removeItemListener(painterChangeListener);
   painterComboBox.removeAllItems();
   for (EntryListPanel p : listPanelSet) {
     painterComboBox.addItem(p.getPainter());
   }
   removedPainters.remove(painter);
   painterComboBox.addItemListener(painterChangeListener);
 }
Beispiel #14
0
  private JPanel createButtons() {
    JPanel panelButton = new JPanel();
    panelButton.setLayout(new MigLayout("right", "[]"));
    buttonInsert = new JButton("New");
    buttonInsert.setIcon(new IconButton().insertIcon());
    panelButton.add(buttonInsert);

    buttonUpdate = new JButton("Update");
    buttonUpdate.setIcon(new IconButton().updateIcon());
    panelButton.add(buttonUpdate);

    buttonDelete = new JButton("Delete");
    buttonDelete.setIcon(new IconButton().deleteIcon());
    panelButton.add(buttonDelete);

    buttonRefresh = new JButton("Refresh");
    buttonRefresh.setIcon(new IconButton().refreshIcon());
    panelButton.add(buttonRefresh);

    return panelButton;
  }
Beispiel #15
0
 public MainPanel() {
   super(new BorderLayout());
   table.setAutoCreateRowSorter(true);
   JPanel p = new JPanel(new GridLayout(2, 1, 5, 5));
   p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
   p.add(componentChoices);
   p.add(
       new JButton(
           new AbstractAction("show") {
             @Override
             public void actionPerformed(ActionEvent e) {
               model.setRowCount(0);
               JComponent c = ((JComponentType) componentChoices.getSelectedItem()).component;
               for (Integer f : focusType) {
                 loadBindingMap(f, c.getInputMap(f), c.getActionMap());
               }
             }
           }));
   add(p, BorderLayout.NORTH);
   add(new JScrollPane(table));
   setPreferredSize(new Dimension(320, 240));
 }
 /** Constructor */
 public ServiceFilterPanel(String text, Vector list) {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   service_box = new JCheckBox(text);
   service_box.addActionListener(this);
   service_data = new Vector();
   if (list != null) {
     service_box.setSelected(true);
     service_data = (Vector) list.clone();
   }
   service_list = new JList(service_data);
   service_list.setBorder(new EtchedBorder());
   service_list.setVisibleRowCount(5);
   service_list.addListSelectionListener(this);
   service_list.setEnabled(service_box.isSelected());
   service_scroll = new JScrollPane(service_list);
   service_scroll.setBorder(new EtchedBorder());
   remove_service_button = new JButton("Remove");
   remove_service_button.addActionListener(this);
   remove_service_button.setEnabled(false);
   remove_service_panel = new JPanel();
   remove_service_panel.setLayout(new FlowLayout());
   remove_service_panel.add(remove_service_button);
   service_area = new JPanel();
   service_area.setLayout(new BorderLayout());
   service_area.add(service_scroll, BorderLayout.CENTER);
   service_area.add(remove_service_panel, BorderLayout.EAST);
   service_area.setBorder(indent_border);
   add_service_field = new JTextField();
   add_service_field.addActionListener(this);
   add_service_field.getDocument().addDocumentListener(this);
   add_service_field.setEnabled(service_box.isSelected());
   add_service_button = new JButton("Add");
   add_service_button.addActionListener(this);
   add_service_button.setEnabled(false);
   add_service_panel = new JPanel();
   add_service_panel.setLayout(new BorderLayout());
   JPanel dummy = new JPanel();
   dummy.setBorder(empty_border);
   add_service_panel.add(dummy, BorderLayout.WEST);
   add_service_panel.add(add_service_button, BorderLayout.EAST);
   add_service_area = new JPanel();
   add_service_area.setLayout(new BorderLayout());
   add_service_area.add(add_service_field, BorderLayout.CENTER);
   add_service_area.add(add_service_panel, BorderLayout.EAST);
   add_service_area.setBorder(indent_border);
   setLayout(new BorderLayout());
   add(service_box, BorderLayout.NORTH);
   add(service_area, BorderLayout.CENTER);
   add(add_service_area, BorderLayout.SOUTH);
   setBorder(empty_border);
 }
Beispiel #17
0
  private Component button() {
    final JButton button = new JButton("Foo!");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            button.setText("The world will end in " + (Math.random() * 100000) + " seconds");
            for (int i = 0; i < tableModel.getRowCount(); i++) {
              int cell = (Integer) tableModel.getValueAt(i, 1);
              tableModel.setValueAt((int) (cell * 1.03), i, 1);
            }
          }
        });

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    panel.add(button);
    return panel;
  }
Beispiel #18
0
  /** Creates an instance <tt>PropertiesEditorPanel</tt>. */
  public PropertiesEditorPanel() {
    super(new BorderLayout());

    /**
     * Instantiates the properties table and adds selection model and listener and adds a row sorter
     * to the table model
     */
    ResourceManagementService r = PropertiesEditorActivator.getResourceManagementService();
    String[] columnNames =
        new String[] {r.getI18NString("service.gui.NAME"), r.getI18NString("service.gui.VALUE")};

    propsTable = new JTable(new PropsTableModel(initTableModel(), columnNames));
    propsTable.setRowSorter(new TableRowSorter<TableModel>(propsTable.getModel()));
    propsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    PropsListSelectionListener selectionListener = new PropsListSelectionListener();

    propsTable.getSelectionModel().addListSelectionListener(selectionListener);
    propsTable.getColumnModel().getSelectionModel().addListSelectionListener(selectionListener);

    JScrollPane scrollPane = new JScrollPane(propsTable);
    SearchField searchField = new SearchField("", propsTable);

    buttonsPanel = new ButtonsPanel(propsTable, searchField);

    centerPanel = new TransparentPanel(new BorderLayout());
    centerPanel.add(scrollPane, BorderLayout.CENTER);
    centerPanel.add(buttonsPanel, BorderLayout.EAST);

    JLabel needRestart = new JLabel(r.getI18NString("plugin.propertieseditor.NEED_RESTART"));

    needRestart.setForeground(Color.RED);

    TransparentPanel searchPanel = new TransparentPanel(new BorderLayout(5, 0));

    searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
    searchPanel.add(searchField, BorderLayout.CENTER);

    setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    add(searchPanel, BorderLayout.NORTH);
    add(centerPanel, BorderLayout.CENTER);
    add(needRestart, BorderLayout.SOUTH);
  }
  /**
   * Sets the current partition that this panel is displaying
   *
   * @param partition the new partition to display
   */
  private void setCurrentPartition(AbstractPartitionData partition) {
    if (partition != null) {
      if (currentPartition != null) optionsPanelParent.removeAll();

      AncestralStatesOptionsPanel panel = optionsPanels.get(partition);
      if (panel == null) {
        panel = new AncestralStatesOptionsPanel(this, options, partition);
        optionsPanels.put(partition, panel);
      }

      currentPartition = partition;

      panel.setupPanel();

      optionsPanelParent.add(panel);

      updateBorder();
    }
  }
  /**
   * The GPropertiesDialog class constructor.
   *
   * @param gui the GUI class
   */
  public GPropertiesDialog(GUI gui) {
    // superclass constructor
    super(gui, "Properties", false);
    objects = new ObjectContainer();

    // gui
    this.gui = gui;

    // set the fixed size
    setSize(260, 350);
    setResizable(false);
    setLayout(null);

    // set up panels for stuff
    pane = new JTabbedPane();

    // add the tabbed panel
    tabbedPanePanel = new JPanel();
    tabbedPanePanel.add(pane);
    tabbedPanePanel.setLayout(null);
    this.getContentPane().add(tabbedPanePanel);
    tabbedPanePanel.setBounds(0, 0, this.getWidth(), 280);
    pane.setBounds(0, 0, tabbedPanePanel.getWidth(), tabbedPanePanel.getHeight());

    // set up buttons
    apply = new JButton("Apply");
    apply.setBounds(150, 290, 80, 26);
    this.getContentPane().add(apply);

    close = new JButton("Close");
    close.setBounds(50, 290, 80, 26);
    this.getContentPane().add(close);

    addPanel(new GPropertiesPanelCustomObject(gui.getGMap()), "Object");

    // add listeners
    addMouseListener(this);
    apply.addItemListener(this);
    apply.addActionListener(this);
    close.addItemListener(this);
    close.addActionListener(this);
  }
Beispiel #21
0
  public TableDeneme() {
    super("Dictionary Window");
    qtm = new QueryTableModel();
    table = new JTable(qtm);
    scrollpane = new JScrollPane(table);
    p1 = new JPanel();
    jb = new JButton("get em all");
    p1.add(jb);

    getContentPane().add(p1, BorderLayout.NORTH);
    getContentPane().add(scrollpane, BorderLayout.CENTER);
    addWindowListener(new BasicWindowMonitor());
    setSize(500, 500);
    setVisible(true);

    JOptionPane.showMessageDialog(
        new Frame(),
        "Press the button,\n"
            + "It will fill the table with all records.\n"
            + "Then you can edit the cells.\n"
            + "When you select another cell, the previous one will updated.\n\n"
            + "*****@*****.**");

    /**
     * ****show selection***** table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); rowSM =
     * table.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener(){ public
     * void valueChanged(ListSelectionEvent e){ if (e.getValueIsAdjusting()) return;
     * ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()){
     * System.out.println("No rows are selected."); } else{
     * System.out.println(table.getValueAt(table.getSelectionModel().getMinSelectionIndex(),0));
     * System.out.println(table.getValueAt(table.getSelectionModel().getMinSelectionIndex(),1)); } }
     * }); ********************
     */
    jb.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            qtm.setHostURL(
                "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL=MS Access;DriverId=281;DBQ=db1.mdb");
            qtm.setQuery("select * from soz");
          }
        });
  }
  public void actionPerformed(ActionEvent e) {
    JButton b = (JButton) e.getSource();
    if (b == bu) {
      j14 = new JLabel("NEW IMAGE");
      j14.setBounds(840, 200, 300, 300);
      q.add(j14);

      JFileChooser filechooser = new JFileChooser();
      int result = filechooser.showOpenDialog(this);
      f = filechooser.getSelectedFile();
      try {
        String dir1 = f.getAbsolutePath();
        // setText(dir);
        str = dir1;
        // ResizeImage.resize(dir);
        f = new File(dir1);
      } catch (Exception e1) {
      }
      repaint();
      // b=(JButton)e.getSource();

    }
    if (b == ba) {
      try {
        read();
        patient.add(tadd.getText(), tsym.getText(), f, str);
        JOptionPane.showMessageDialog(null, "Patient ID: " + patient.pid + " Record Added");
      } catch (Exception e4) {
        System.out.println("" + e4);
      }
    }
    if (b == bm) {
      try {
        setVisible(false);
      } catch (Exception e4) {
        System.out.println("" + e4);
      }
    }
  }
 /** Applet initialization */
 public void init() {
   // Get the port to be used
   String port_str = getParameter("port");
   if (port_str != null) {
     port = Integer.parseInt(port_str);
   }
   // Try to use the system look and feel
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception e) {
   }
   // Create main panel to hold notebook
   main_panel = new JPanel();
   main_panel.setBackground(Color.white);
   main_panel.setLayout(new BorderLayout());
   setContentPane(main_panel);
   // Create the notebook
   tabbed_pane = new JTabbedPane(JTabbedPane.TOP);
   main_panel.add(tabbed_pane, BorderLayout.CENTER);
   // Add notebook page for default host connection
   pages = new Vector();
   addPage(new SOAPMonitorPage(getCodeBase().getHost()));
 }
  public void SpelersCombo(int ronde) {
    String[] spelers = null;
    if (ronde == 0) {
      spelers = new String[1];
      spelers[0] = "Geen Spelers";
    } else {
      spelers = oc.GeefSpelers(ronde);
    }

    ComboBoxModel cbSpelerModel = new DefaultComboBoxModel(spelers);
    cbSpeler = new JComboBox();
    pInzet.add(cbSpeler);
    cbSpeler.setModel(cbSpelerModel);
    cbSpeler.setBounds(91, 63, 156, 21);
    cbSpeler.setToolTipText("Maak een keuze uit een van de (meespelende) spelers.");
    cbSpeler.addItemListener(
        new ItemListener() {

          public void itemStateChanged(ItemEvent evt) {
            cbSpelerItemStateChanged(evt);
          }
        });
  } // public void SpelersCombo(int ronde)
  public JComponent createContestantList() {
    JPanel contListPanel = new JPanel();

    MyTableModel contTable = new MyTableModel();

    JTable table = new JTable(contTable);

    table.setPreferredScrollableViewportSize(new Dimension(WIDTH, HEIGHT));
    table.setFillsViewportHeight(true);
    table.setAutoCreateRowSorter(true);
    table.setRowHeight(77);

    table.setFont(new Font("Viner Hand ITC", Font.PLAIN, 18));
    table.setForeground(Color.BLUE);
    table.setSelectionForeground(Color.RED);
    table.setSelectionBackground(
        new Color(0, 0, 0, 64)); // When a cell is selected, this entire row is highlighted.

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);
    contListPanel.add(scrollPane);

    return contListPanel;
  }
 private void jbInit() throws Exception {
   panel1.setLayout(borderLayout1);
   okButton.setText("OK");
   okButton.addActionListener(new MimeTypeEditor_okButton_actionAdapter(this));
   filtersTable.setRowSelectionAllowed(true);
   filtersTable.setPreferredSize(new Dimension(418, 200));
   filtersTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
   filtersTable.setCellSelectionEnabled(true);
   filtersTable.setColumnSelectionAllowed(false);
   filtersTable.setModel(m_model);
   addButton.setToolTipText(
       "Add a new " + mimeTypeEditorBuilder.getValueName() + " for a MIME type");
   addButton.setText("Add");
   addButton.addActionListener(new MimeTypeEditor_addButton_actionAdapter(this));
   cancelButton.setText("Cancel");
   cancelButton.addActionListener(new MimeTypeEditor_cancelButton_actionAdapter(this));
   deleteButton.setToolTipText("Delete the currently selected item.");
   deleteButton.setText("Delete");
   deleteButton.addActionListener(new MimeTypeEditor_deleteButton_actionAdapter(this));
   upButton.setText("Up");
   upButton.addActionListener(new MimeTypeEditor_upButton_actionAdapter(this));
   dnButton.setText("Down");
   dnButton.addActionListener(new MimeTypeEditor_dnButton_actionAdapter(this));
   panel1.setPreferredSize(new Dimension(418, 200));
   jScrollPane1.setMinimumSize(new Dimension(200, 80));
   jScrollPane1.setOpaque(true);
   buttonPanel.add(dnButton, null);
   buttonPanel.add(upButton, null);
   buttonPanel.add(addButton, null);
   buttonPanel.add(deleteButton, null);
   buttonPanel.add(okButton, null);
   buttonPanel.add(cancelButton, null);
   getContentPane().add(panel1);
   panel1.add(buttonPanel, BorderLayout.SOUTH);
   panel1.add(jScrollPane1, BorderLayout.CENTER);
   jScrollPane1.getViewport().add(filtersTable, null);
 }
  public TabelProduk() {
    // tfFilter = new JTextField(30);
    // bFilter = new JButton("filter");
    bHapus = new JButton("hapus");

    panelUtama = new JPanel(new BorderLayout());
    // panelFilter = new JPanel();
    panelButton = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    // set jenis
    setJenis();

    // panel utama
    setDataTabel();
    srcTabel = new JScrollPane(tabel);

    // panelUtama.add(panelFilter,"North");
    panelUtama.add(srcTabel, "Center");
    panelUtama.add(panelButton, "South");

    // filter
    // panelFilter.add(new JLabel("filter : "));
    // panelFilter.add(tfFilter);
    // panelFilter.add(bFilter);

    // untuk button
    panelButton.add(bHapus);

    class HapusListener implements ListSelectionListener, ActionListener {
      private int idProduk;

      public void valueChanged(ListSelectionEvent e) {
        int baris = tabel.getSelectedRow();

        if (baris > -1) {
          Produk p = dataProduk.get(baris);
          idProduk = p.getIdProduk();
        }
      }

      public void actionPerformed(ActionEvent ev) {
        try {
          // stok
          String query = "DELETE FROM stok_produk WHERE id_produk=" + idProduk;
          int hasil1 = stm.executeUpdate(query);

          // pemasukkan
          query = "DELETE FROM pemasukan WHERE id_produk=" + idProduk;
          int hasil2 = stm.executeUpdate(query);

          // pengeluaran
          query = "DELETE FROM pengeluaran WHERE id_produk=" + idProduk;
          int hasil3 = stm.executeUpdate(query);

          // produk
          query = "DELETE FROM produk WHERE id_produk=" + idProduk;
          int hasil4 = stm.executeUpdate(query);

          if (hasil1 == 1 || hasil2 == 1 || hasil3 == 1 && hasil4 == 1) {
            setDataTabel();
            JOptionPane.showMessageDialog(null, "berhasil hapus");
          } else {
            JOptionPane.showMessageDialog(null, "gagal");
          }
        } catch (SQLException SQLerr) {
          SQLerr.printStackTrace();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }

    HapusListener hl = new HapusListener();
    tabel.getSelectionModel().addListSelectionListener(hl);
    bHapus.addActionListener(hl);
  }
    protected void initComponents(
        AirspaceBuilderModel model, final AirspaceBuilderController controller) {
      final JCheckBox resizeNewShapesCheckBox;
      final JCheckBox enableEditCheckBox;

      JPanel newShapePanel = new JPanel();
      {
        JButton newShapeButton = new JButton("New shape");
        newShapeButton.setActionCommand(NEW_AIRSPACE);
        newShapeButton.addActionListener(controller);
        newShapeButton.setToolTipText("Create a new shape centered in the viewport");

        this.factoryComboBox = new JComboBox(defaultAirspaceFactories);
        this.factoryComboBox.setEditable(false);
        this.factoryComboBox.setToolTipText("Choose shape type to create");

        resizeNewShapesCheckBox = new JCheckBox("Fit new shapes to viewport");
        resizeNewShapesCheckBox.setActionCommand(SIZE_NEW_SHAPES_TO_VIEWPORT);
        resizeNewShapesCheckBox.addActionListener(controller);
        resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport());
        resizeNewShapesCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
        resizeNewShapesCheckBox.setToolTipText(
            "New shapes are sized to fit the geographic viewport");

        enableEditCheckBox = new JCheckBox("Enable shape editing");
        enableEditCheckBox.setActionCommand(ENABLE_EDIT);
        enableEditCheckBox.addActionListener(controller);
        enableEditCheckBox.setSelected(controller.isEnableEdit());
        enableEditCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
        enableEditCheckBox.setToolTipText("Allow modifications to shapes");

        Box newShapeBox = Box.createHorizontalBox();
        newShapeBox.add(newShapeButton);
        newShapeBox.add(Box.createHorizontalStrut(5));
        newShapeBox.add(this.factoryComboBox);
        newShapeBox.setAlignmentX(Component.LEFT_ALIGNMENT);

        JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap
        gridPanel.add(newShapeBox);
        gridPanel.add(resizeNewShapesCheckBox);
        gridPanel.add(enableEditCheckBox);

        newShapePanel.setLayout(new BorderLayout());
        newShapePanel.add(gridPanel, BorderLayout.NORTH);
      }

      JPanel entryPanel = new JPanel();
      {
        this.entryTable = new JTable(model);
        this.entryTable.setColumnSelectionAllowed(false);
        this.entryTable.setRowSelectionAllowed(true);
        this.entryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.entryTable
            .getSelectionModel()
            .addListSelectionListener(
                new ListSelectionListener() {
                  public void valueChanged(ListSelectionEvent e) {
                    if (!ignoreSelectEvents) {
                      controller.actionPerformed(
                          new ActionEvent(e.getSource(), -1, SELECTION_CHANGED));
                    }
                  }
                });
        this.entryTable.setToolTipText("<html>Click to select<br>Double-Click to rename</html>");

        JScrollPane tablePane = new JScrollPane(this.entryTable);
        tablePane.setPreferredSize(new Dimension(200, 100));

        entryPanel.setLayout(new BorderLayout(0, 0)); // hgap, vgap
        entryPanel.add(tablePane, BorderLayout.CENTER);
      }

      JPanel selectionPanel = new JPanel();
      {
        JButton delselectButton = new JButton("Deselect");
        delselectButton.setActionCommand(CLEAR_SELECTION);
        delselectButton.addActionListener(controller);
        delselectButton.setToolTipText("Clear the selection");

        JButton deleteButton = new JButton("Delete Selected");
        deleteButton.setActionCommand(REMOVE_SELECTED);
        deleteButton.addActionListener(controller);
        deleteButton.setToolTipText("Delete selected shapes");

        JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap
        gridPanel.add(delselectButton);
        gridPanel.add(deleteButton);

        selectionPanel.setLayout(new BorderLayout());
        selectionPanel.add(gridPanel, BorderLayout.NORTH);
      }

      this.setLayout(new BorderLayout(30, 0)); // hgap, vgap
      this.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); // top, left, bottom, right
      this.add(newShapePanel, BorderLayout.WEST);
      this.add(entryPanel, BorderLayout.CENTER);
      this.add(selectionPanel, BorderLayout.EAST);

      controller.addPropertyChangeListener(
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent e) {
              if (SIZE_NEW_SHAPES_TO_VIEWPORT.equals(e.getPropertyName())) {
                resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport());
              } else if (ENABLE_EDIT.equals(e.getPropertyName())) {
                enableEditCheckBox.setSelected(controller.isEnableEdit());
              }
            }
          });
    }
Beispiel #29
0
  /**
   * Creates basic controls for a type (AUDIO or VIDEO).
   *
   * @param type the type.
   * @return the build Component.
   */
  public static Component createBasicControls(final int type) {
    final JComboBox deviceComboBox = new JComboBox();

    deviceComboBox.setEditable(false);
    deviceComboBox.setModel(
        new DeviceConfigurationComboBoxModel(
            deviceComboBox, mediaService.getDeviceConfiguration(), type));

    JLabel deviceLabel = new JLabel(getLabelText(type));

    deviceLabel.setDisplayedMnemonic(getDisplayedMnemonic(type));
    deviceLabel.setLabelFor(deviceComboBox);

    final Container devicePanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));

    devicePanel.setMaximumSize(new Dimension(WIDTH, 25));
    devicePanel.add(deviceLabel);
    devicePanel.add(deviceComboBox);

    final JPanel deviceAndPreviewPanel = new TransparentPanel(new BorderLayout());
    int preferredDeviceAndPreviewPanelHeight;

    switch (type) {
      case DeviceConfigurationComboBoxModel.AUDIO:
        preferredDeviceAndPreviewPanelHeight = 225;
        break;
      case DeviceConfigurationComboBoxModel.VIDEO:
        preferredDeviceAndPreviewPanelHeight = 305;
        break;
      default:
        preferredDeviceAndPreviewPanelHeight = 0;
        break;
    }
    if (preferredDeviceAndPreviewPanelHeight > 0)
      deviceAndPreviewPanel.setPreferredSize(
          new Dimension(WIDTH, preferredDeviceAndPreviewPanelHeight));
    deviceAndPreviewPanel.add(devicePanel, BorderLayout.NORTH);

    final ActionListener deviceComboBoxActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            boolean revalidateAndRepaint = false;

            for (int i = deviceAndPreviewPanel.getComponentCount() - 1; i >= 0; i--) {
              Component c = deviceAndPreviewPanel.getComponent(i);

              if (c != devicePanel) {
                deviceAndPreviewPanel.remove(i);
                revalidateAndRepaint = true;
              }
            }

            Component preview = null;

            if ((deviceComboBox.getSelectedItem() != null) && deviceComboBox.isShowing()) {
              preview =
                  createPreview(type, deviceComboBox, deviceAndPreviewPanel.getPreferredSize());
            }

            if (preview != null) {
              deviceAndPreviewPanel.add(preview, BorderLayout.CENTER);
              revalidateAndRepaint = true;
            }

            if (revalidateAndRepaint) {
              deviceAndPreviewPanel.revalidate();
              deviceAndPreviewPanel.repaint();
            }
          }
        };

    deviceComboBox.addActionListener(deviceComboBoxActionListener);
    /*
     * We have to initialize the controls to reflect the configuration
     * at the time of creating this instance. Additionally, because the
     * video preview will stop when it and its associated controls
     * become unnecessary, we have to restart it when the mentioned
     * controls become necessary again. We'll address the two goals
     * described by pretending there's a selection in the video combo
     * box when the combo box in question becomes displayable.
     */
    deviceComboBox.addHierarchyListener(
        new HierarchyListener() {
          public void hierarchyChanged(HierarchyEvent event) {
            if ((event.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
              SwingUtilities.invokeLater(
                  new Runnable() {
                    public void run() {
                      deviceComboBoxActionListener.actionPerformed(null);
                    }
                  });
            }
          }
        });

    return deviceAndPreviewPanel;
  }
Beispiel #30
0
  /**
   * Creates the video advanced settings.
   *
   * @return video advanced settings panel.
   */
  private static Component createVideoAdvancedSettings() {
    ResourceManagementService resources = NeomediaActivator.getResources();

    final DeviceConfiguration deviceConfig = mediaService.getDeviceConfiguration();

    TransparentPanel centerPanel = new TransparentPanel(new GridBagLayout());
    centerPanel.setMaximumSize(new Dimension(WIDTH, 150));

    JButton resetDefaultsButton =
        new JButton(resources.getI18NString("impl.media.configform.VIDEO_RESET"));
    JPanel resetButtonPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));
    resetButtonPanel.add(resetDefaultsButton);

    final JPanel centerAdvancedPanel = new TransparentPanel(new BorderLayout());
    centerAdvancedPanel.add(centerPanel, BorderLayout.NORTH);
    centerAdvancedPanel.add(resetButtonPanel, BorderLayout.SOUTH);

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.insets = new Insets(5, 5, 0, 0);
    constraints.gridx = 0;
    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.gridy = 0;

    centerPanel.add(
        new JLabel(resources.getI18NString("impl.media.configform.VIDEO_RESOLUTION")), constraints);
    constraints.gridy = 1;
    constraints.insets = new Insets(0, 0, 0, 0);
    final JCheckBox frameRateCheck =
        new SIPCommCheckBox(resources.getI18NString("impl.media.configform.VIDEO_FRAME_RATE"));
    centerPanel.add(frameRateCheck, constraints);
    constraints.gridy = 2;
    constraints.insets = new Insets(5, 5, 0, 0);
    centerPanel.add(
        new JLabel(resources.getI18NString("impl.media.configform.VIDEO_PACKETS_POLICY")),
        constraints);

    constraints.weightx = 1;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.insets = new Insets(5, 0, 0, 5);
    Object[] resolutionValues = new Object[DeviceConfiguration.SUPPORTED_RESOLUTIONS.length + 1];
    System.arraycopy(
        DeviceConfiguration.SUPPORTED_RESOLUTIONS,
        0,
        resolutionValues,
        1,
        DeviceConfiguration.SUPPORTED_RESOLUTIONS.length);
    final JComboBox sizeCombo = new JComboBox(resolutionValues);
    sizeCombo.setRenderer(new ResolutionCellRenderer());
    sizeCombo.setEditable(false);
    centerPanel.add(sizeCombo, constraints);

    // default value is 20
    final JSpinner frameRate = new JSpinner(new SpinnerNumberModel(20, 5, 30, 1));
    frameRate.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            deviceConfig.setFrameRate(
                ((SpinnerNumberModel) frameRate.getModel()).getNumber().intValue());
          }
        });
    constraints.gridy = 1;
    constraints.insets = new Insets(0, 0, 0, 5);
    centerPanel.add(frameRate, constraints);

    frameRateCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (frameRateCheck.isSelected()) {
              deviceConfig.setFrameRate(
                  ((SpinnerNumberModel) frameRate.getModel()).getNumber().intValue());
            } else // unlimited framerate
            deviceConfig.setFrameRate(-1);

            frameRate.setEnabled(frameRateCheck.isSelected());
          }
        });

    final JSpinner videoMaxBandwidth =
        new JSpinner(
            new SpinnerNumberModel(deviceConfig.getVideoMaxBandwidth(), 1, Integer.MAX_VALUE, 1));
    videoMaxBandwidth.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            deviceConfig.setVideoMaxBandwidth(
                ((SpinnerNumberModel) videoMaxBandwidth.getModel()).getNumber().intValue());
          }
        });
    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.insets = new Insets(0, 0, 5, 5);
    centerPanel.add(videoMaxBandwidth, constraints);

    resetDefaultsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // reset to defaults
            sizeCombo.setSelectedIndex(0);
            frameRateCheck.setSelected(false);
            frameRate.setEnabled(false);
            frameRate.setValue(20);
            // unlimited framerate
            deviceConfig.setFrameRate(-1);
            videoMaxBandwidth.setValue(DeviceConfiguration.DEFAULT_VIDEO_MAX_BANDWIDTH);
          }
        });

    // load selected value or auto
    Dimension videoSize = deviceConfig.getVideoSize();

    if ((videoSize.getHeight() != DeviceConfiguration.DEFAULT_VIDEO_HEIGHT)
        && (videoSize.getWidth() != DeviceConfiguration.DEFAULT_VIDEO_WIDTH))
      sizeCombo.setSelectedItem(deviceConfig.getVideoSize());
    else sizeCombo.setSelectedIndex(0);
    sizeCombo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Dimension selectedVideoSize = (Dimension) sizeCombo.getSelectedItem();

            if (selectedVideoSize == null) {
              // the auto value, default one
              selectedVideoSize =
                  new Dimension(
                      DeviceConfiguration.DEFAULT_VIDEO_WIDTH,
                      DeviceConfiguration.DEFAULT_VIDEO_HEIGHT);
            }
            deviceConfig.setVideoSize(selectedVideoSize);
          }
        });

    frameRateCheck.setSelected(
        deviceConfig.getFrameRate() != DeviceConfiguration.DEFAULT_VIDEO_FRAMERATE);
    frameRate.setEnabled(frameRateCheck.isSelected());

    if (frameRate.isEnabled()) frameRate.setValue(deviceConfig.getFrameRate());

    return centerAdvancedPanel;
  }