private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) {
    final JTable theTable = new JTable();
    PrimitiveFormPropertyPair pfpPair =
        new PrimitiveFormPropertyPair(primitiveForm.getName(), property);
    _dynamicTables.put(pfpPair, theTable);
    DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType();
    final DynamicDOTItemManager tableModel =
        (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property);
    theTable.setModel(tableModel);

    class NumberComparator implements Comparator<Number> {

      public int compare(Number o1, Number o2) {
        final double d1 = o1.doubleValue();
        final double d2 = o2.doubleValue();
        if (d1 < d2) {
          return -1;
        }
        if (d1 == d2) {
          return 0;
        }
        return 1;
      }
    }
    TableRowSorter<DynamicDOTItemManager> tableRowSorter =
        new TableRowSorter<DynamicDOTItemManager>();
    tableRowSorter.setModel(tableModel);
    tableRowSorter.setComparator(4, new NumberComparator());
    tableRowSorter.setComparator(5, new NumberComparator());
    theTable.setRowSorter(tableRowSorter);

    JButton newDOTItemButton = new JButton("Neue Zeile");
    newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JButton deleteDOTItemButton = new JButton("Zeile löschen");
    deleteDOTItemButton.setEnabled(false);
    JButton showConflictsButton = new JButton("Zeige Konflikte");

    addButtonListeners(
        primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton);
    addListSelectionListener(theTable, deleteDOTItemButton);

    JPanel dotButtonsPanel = new JPanel();
    dotButtonsPanel.setLayout(new SpringLayout());

    dotButtonsPanel.add(newDOTItemButton);
    dotButtonsPanel.add(deleteDOTItemButton);
    dotButtonsPanel.add(showConflictsButton);

    dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
    SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20);

    JPanel thePanel = new JPanel();
    thePanel.setLayout(new SpringLayout());
    thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK));
    thePanel.add(new JScrollPane(theTable));
    thePanel.add(dotButtonsPanel);
    SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5);

    return thePanel;
  }
Exemplo n.º 2
0
  /** Constructor for objects of class Cart_Add */
  public Cart_Add(int itemID) {
    this.setLayout(null);
    this.setMaximumSize(new Dimension(1400, 50));
    product = invAccess.GetProductInfo(itemID);
    /** Create the DAO here */
    name = new JLabel(product.getName());
    discount = new JTextField();
    discount.setText(String.valueOf(product.getDiscount()));

    add.addActionListener(this);

    /** Absolute Positioning of the components */
    Insets insets = this.getInsets();
    /** The dimentsions of the JPanel */
    this.add(name);
    name.setBounds(25 + insets.left, 15 + insets.top, 250, 25);
    this.add(discount);
    discount.setBounds(125 + insets.left, 15 + insets.top, 75, 25);
    this.add(add);
    add.setBounds(250 + insets.left, 15 + insets.top, 85, 25);

    // this.setBorder (BorderFactory.createLineBorder(Color.black));
    product = invAccess.GetProductInfo(itemID);

    this.setVisible(true);
  }
Exemplo n.º 3
0
  public void newframe() {
    JFrame frame = new JFrame("Cab Service ");
    frame.setSize(800, 600);

    frame.setVisible(true);
    // frame.setBackground(Color.CYAN);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton jb = new JButton("Set Name of Places ");
    jb.setBounds(100, 100, 20, 50);

    JPanel jp = new JPanel();
    jp.setBackground(Color.gray);
    jp.add(jb);
    frame.add(jp);
    JPanel jp1 = new JPanel();
    jp1.setBackground(Color.gray);
    frame.add(jp1);

    frame.add(jp);
    jb.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            try {
              CreateFrame();

            } catch (IOException ex) {
              Logger.getLogger(SetMap.class.getName()).log(Level.SEVERE, null, ex);
            }
          }
        });
  }
Exemplo n.º 4
0
  public About() {
    cl = ClassLoader.getSystemClassLoader();

    // ----------------------------------------CENTER--------------------------------//
    imgAbout = new ImageIcon(cl.getResource("om.png"));

    lblAbout = new JLabel(imgAbout);

    lblAbout.setBounds(0, 0, 450, 263);

    JPanel pnlCenter = new JPanel();
    pnlCenter.setLayout(null);
    pnlCenter.add(lblAbout);

    btnOk = new JButton(new ImageIcon(cl.getResource("ok.png")));
    btnOk.setBounds(390, 215, 40, 30);
    pnlCenter.add(btnOk);
    btnOk.addActionListener(this);

    // -----------------------------------CONTAINER----------------------------------//
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(pnlCenter, BorderLayout.CENTER);
    setSize(450, 280);
    setVisible(true);
    setResizable(false);
    setLocation(580, 280);
    // setDefaultCloseOperation(EXIT_ON_CLOSE);

  }
 public CFSecuritySwingISOCurrencyAskDeleteJPanel(
     ICFSecuritySwingSchema argSchema, ICFSecurityISOCurrencyObj argFocus) {
   super();
   final String S_ProcName = "construct-schema-focus";
   if (argSchema == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema");
   }
   // argFocus is optional; focus may be set later during execution as
   // conditions of the runtime change.
   swingSchema = argSchema;
   swingFocus = argFocus;
   // Construct the various objects
   textAreaMessage = new JTextArea("Are you sure you want to delete this ISO Currency?");
   actionOk = new ActionOk();
   actionCancel = new ActionCancel();
   buttonOk = new JButton(actionOk);
   buttonCancel = new JButton(actionCancel);
   attrJPanel = argSchema.getISOCurrencyFactory().newAttrJPanel(argFocus);
   scrollPane = new CFHSlaveJScrollPane(attrJPanel);
   // Lay out the widgets
   setSize(1024, 480);
   Dimension min = new Dimension(480, 300);
   setMinimumSize(min);
   add(textAreaMessage);
   textAreaMessage.setBounds(0, 0, 1024, 50);
   int xparts = (768 - (2 * 125)) / 3;
   add(buttonOk);
   buttonOk.setBounds(xparts, 55, 125, 40);
   add(buttonCancel);
   buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40);
   add(scrollPane);
   scrollPane.setBounds(0, 100, 1024, 480 - 100);
 }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == jb1) {
     try {
       strategyFrame =
           new StrategyFrame(
               trainingTeaBLService.showFrameStrategy(), trainingTeaBLService, jb1.getText());
       strategyFrame.setTrainingTeaWindow(this.trainingTeaWindow);
     } catch (RemoteException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
     }
   } else if (e.getSource() == jb2) {
     try {
       strategyFrame =
           new StrategyFrame(
               trainingTeaBLService.showFrameStrategy(), trainingTeaBLService, jb2.getText());
       strategyFrame.setTrainingTeaWindow(this.trainingTeaWindow);
     } catch (RemoteException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
     }
   } else if (e.getSource() == refresh) {
     refresh();
   }
 }
Exemplo n.º 7
0
  public PostTestFrame() {
    setTitle("PostTest");

    northPanel = new JPanel();
    add(northPanel, BorderLayout.NORTH);
    northPanel.setLayout(new GridLayout(0, 2));
    northPanel.add(new JLabel("Host: ", SwingConstants.TRAILING));
    final JTextField hostField = new JTextField();
    northPanel.add(hostField);
    northPanel.add(new JLabel("Action: ", SwingConstants.TRAILING));
    final JTextField actionField = new JTextField();
    northPanel.add(actionField);
    for (int i = 1; i <= 8; i++) northPanel.add(new JTextField());

    final JTextArea result = new JTextArea(20, 40);
    add(new JScrollPane(result));

    JPanel southPanel = new JPanel();
    add(southPanel, BorderLayout.SOUTH);
    JButton addButton = new JButton("More");
    southPanel.add(addButton);
    addButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            northPanel.add(new JTextField());
            northPanel.add(new JTextField());
            pack();
          }
        });

    JButton getButton = new JButton("Get");
    southPanel.add(getButton);
    getButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            result.setText("");
            final Map<String, String> post = new HashMap<String, String>();
            for (int i = 4; i < northPanel.getComponentCount(); i += 2) {
              String name = ((JTextField) northPanel.getComponent(i)).getText();
              if (name.length() > 0) {
                String value = ((JTextField) northPanel.getComponent(i + 1)).getText();
                post.put(name, value);
              }
            }
            new SwingWorker<Void, Void>() {
              protected Void doInBackground() throws Exception {
                try {
                  String urlString = hostField.getText() + "/" + actionField.getText();
                  result.setText(doPost(urlString, post));
                } catch (IOException e) {
                  result.setText("" + e);
                }
                return null;
              }
            }.execute();
          }
        });

    pack();
  }
Exemplo n.º 8
0
  /**
   * Constructor that takes model as a parameter
   *
   * @param model
   */
  public BoardFrame(Model model) {
    this.model = model;
    data = model.getData();
    gameOver = false;
    initScreen();
    setLayout(new BorderLayout());
    setLocation(300, 200);

    // undoBtn is a controller that resets the turn and last state of board
    undoBtn = new JButton("Undo : " + this.model.getUndoCounter());
    undoBtn.setPreferredSize(new Dimension(80, 50));

    undoBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (BoardFrame.this.model.getUndoCounter() != 0) {
              BoardFrame.this.model.undo();
              undoBtn.setText("Undo : " + BoardFrame.this.model.getUndoCounter());
            } else ;
          }
        });
    JPanel undoPanel = new JPanel();
    undoPanel.add(undoBtn);
    // end of undoBtn code

    add(boardPanel, BorderLayout.CENTER);
    add(undoPanel, BorderLayout.SOUTH);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pack();
    setResizable(false);
    setVisible(true);
  }
Exemplo n.º 9
0
  /**
   * Shows given list of reading lists.
   *
   * @param lists lists.
   */
  protected void setReadingLists(ReadingList[] lists) {
    tblReadingLists.setEnabled(lists != null);
    btnAddReadingList.setEnabled(lists != null);
    btnRemoveList.setEnabled(lists != null);

    readingListsModel.setLists(lists);
  }
Exemplo n.º 10
0
  /**
   * Builds reading lists tab.
   *
   * @return component.
   */
  protected JComponent buildReadingListsTab() {
    // Wording
    JComponent wording = msg(Strings.message("guide.dialog.readinglists.wording"));

    // Buttons
    Dimension btnSize = new Dimension(20, 20);
    btnAddReadingList.setPreferredSize(btnSize);
    btnRemoveList.setPreferredSize(btnSize);
    FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
    JPanel bbar = new JPanel(layout);
    bbar.add(btnAddReadingList);
    bbar.add(btnRemoveList);
    layout.setHgap(0);
    layout.setVgap(0);

    // Panel
    BBFormBuilder builder = new BBFormBuilder("0:grow");
    builder.setDefaultDialogBorder();

    builder.append(wording);
    builder.appendUnrelatedComponentsGapRow(2);
    builder.appendRow("min:grow");
    builder.append(new JScrollPane(tblReadingLists), 1, CellConstraints.FILL, CellConstraints.FILL);
    builder.append(bbar);

    return builder.getPanel();
  }
  public void go() {
    picture();
    ActionListener listener = new BtListener();
    go.addActionListener(listener);
    btn_update_manual.addActionListener(listener);
    go.setForeground(Color.black);
    // rights.setFont((new Font("Arial", Font.PLAIN, 12)));
    title.setFont((new Font("Arial", Font.BOLD, 36)));
    title.setForeground(new Color(238, 253, 253));
    today.setFont((new Font("Arial", Font.BOLD, 16)));
    today.setForeground(new Color(163, 184, 204));
    frame.setLayout(new BorderLayout());
    from.setBackground(Color.white);
    to.setBackground(Color.white);
    converted.setFont(new Font("Arial", Font.BOLD, 24));
    converted.setForeground(new Color(238, 253, 253));
    Lfrom.setForeground(new Color(238, 253, 253));
    Lto.setForeground(new Color(238, 253, 253));
    quantity.setForeground(new Color(238, 253, 253));
    Lfrom.setFont(new Font("Arial", Font.BOLD, 24));
    Lto.setFont(new Font("Arial", Font.BOLD, 24));
    quantity.setFont(new Font("Arial", Font.BOLD, 24));
    north.setLayout(new FlowLayout());
    north.add(title);
    north.setBackground(new Color(59, 62, 71));
    frame.add(BorderLayout.NORTH, north);
    inner.setLayout(new BorderLayout());
    inner.add(BorderLayout.NORTH, today);
    inner.add(BorderLayout.WEST, picPanel);
    center.setLayout(new GridLayout(2, 4, 5, 5));
    center.add(Lfrom);
    center.add(from);
    center.add(Lto);
    center.add(to);
    center.add(quantity);
    center.add(amount);
    center.add(go);
    inner.setBackground(new Color(59, 62, 71));
    inner.add(BorderLayout.SOUTH, center);
    center.setBackground(new Color(59, 62, 71));
    frame.add(BorderLayout.CENTER, inner);
    south.setBackground(new Color(59, 62, 71));
    south.setLayout(new FlowLayout());
    south.add(converted);
    south.add(answer);
    south.add(btn_update_manual);
    // south.add(rights);
    frame.add(BorderLayout.SOUTH, south);
    frame.setSize(850, 700);
    frame.setVisible(true);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent event) {
            frame.setVisible(false);
            frame.dispose();
            System.exit(0);
          }
        });
  }
Exemplo n.º 12
0
 private void moveCacheToState(ComponentStatus state) {
   switch (state) {
     case INITIALIZING:
       cacheStatus.setText(statusStarting);
       processAction(actionButton, true);
       break;
     case RUNNING:
       setCacheTabsStatus(true);
       actionButton.setText(stopCacheButtonLabel);
       processAction(actionButton, false);
       cacheStatus.setText(statusStarted);
       updateTitleBar();
       break;
     case STOPPING:
       cacheStatus.setText(statusStopping);
       processAction(actionButton, true);
       break;
     case TERMINATED:
       setCacheTabsStatus(false);
       actionButton.setText(startCacheButtonLabel);
       processAction(actionButton, false);
       cacheStatus.setText(statusStopped);
       updateTitleBar();
   }
   controlPanelTab.repaint();
 }
Exemplo n.º 13
0
 public RemoveFrame() {
   frame = new JFrame("Select Files you wish to Remove from Drive");
   frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
   frame.getRootPane().setDefaultButton(confirm);
   try {
     files = DriveList.list();
   } catch (IOException e) {
     files = new ArrayList<File>();
   }
   confirm = new JButton("Remove");
   quit = new JButton("Cancel");
   confirm.addActionListener(this);
   quit.addActionListener(this);
   frame.setLayout(new BorderLayout());
   checkPanel = new JPanel();
   control = new JPanel();
   control.setLayout(new GridLayout(1, 2));
   control.add(confirm);
   control.add(quit);
   frame.add(control, BorderLayout.SOUTH);
   drawCheckPanel();
   frame.add(checkPanel, BorderLayout.CENTER);
   frame.pack();
   frame.setVisible(true);
 }
Exemplo n.º 14
0
  public GuideFrame() {

    setTitle("Portal");
    setSize(510, 95);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

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

    // Determine the new location of the window
    int w = this.getSize().width;
    int h = this.getSize().height;
    int x = (dim.width - w) / 2;
    int y = (dim.height - h) / 2;

    // Move the window
    this.setLocation(x, y);

    GuidePanel portalPanel = new GuidePanel();
    portalPanel.setName("shit");

    add(portalPanel);

    for (final JButton j : GuidePanel.bList) {
      j.addMouseListener(this);
    }
  }
Exemplo n.º 15
0
 Main() {
   f = new JFrame("Wiki Seach");
   JPanel p = new JPanel();
   JPanel p1 = new JPanel();
   b = new JButton("Search");
   b1 = new JButton("Exit");
   t = new JTextField(30);
   b.addActionListener(this);
   b1.addActionListener(this);
   p1.add(b);
   p1.add(b1);
   p.add(t);
   f.setLayout(new GridLayout(2, 1));
   f.add(p);
   f.add(p1);
   f.pack();
   f.setLocationRelativeTo(null);
   f.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   f.setVisible(true);
 }
  /** Simple test program. */
  public static void main(String[] args) {
    final JFrame frame = new JFrame("Testing AddPersonDialog");
    JButton button = new JButton("Click me");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            FamilyTree tree = new FamilyTree();
            AddPersonDialog dialog = new AddPersonDialog(frame, tree);
            dialog.pack();
            dialog.setLocationRelativeTo(frame);
            dialog.setVisible(true);

            Person newPerson = dialog.getPerson();
            if (newPerson != null) {
              tree.addPerson(newPerson);
              PrettyPrinter pretty = new PrettyPrinter(new PrintWriter(System.out, true));
              pretty.dump(tree);
            }
          }
        });
    frame.getContentPane().add(button);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(1);
          }
        });
    frame.pack();
    frame.setVisible(true);
  }
Exemplo n.º 17
0
  protected DictionaryWindow(MainFrame parent) {
    super(parent, true);
    setTitle("Dictionary");
    setBounds(new Rectangle(0, 0, 330, 330));

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

    DefaultListModel<String> listModel = new DefaultListModel<String>();
    JList<String> list = new JList<String>(listModel);
    JScrollPane scroll = new JScrollPane(list);
    for (String word : parent.dictionary.getSortedDictionary()) listModel.addElement(word);

    JButton ok = new JButton("OK");
    ok.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });

    mainPanel.add(scroll, BorderLayout.CENTER);
    mainPanel.add(ok, BorderLayout.SOUTH);

    add(mainPanel);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);
    setVisible(true);
  }
  /*
   * The following method creates the color chooser dialog box
   */
  public void createColorDialog() {
    colorDialog = new JDialog(this, new String("Choose a color"), true);
    colorDialog.getContentPane().add(createColorPicker(), BorderLayout.CENTER);

    JButton okButton = new JButton("OK");

    // This class is used to create a special ActionListener for
    //    the ok button
    class ButtonListener implements ActionListener {
      /*
       * This method is called whenever the ok button is clicked
       */
      public void actionPerformed(ActionEvent event) {
        currentChoice.changeColor(color_panel.getColor());
        currentChoice.repaint();
        fontColor = color_panel.getColor();
        colorDialog.hide();
      } // end actionPerformed method
    }
    ActionListener listener = new ButtonListener();
    okButton.addActionListener(listener);

    // Add the four font control panels to one big panel using
    //  a grid layout
    JPanel buttonPanel = new JPanel();

    buttonPanel.add(okButton);

    // Add the button panel to the content pane of the ColorDialogue
    colorDialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    colorDialog.pack();
  }
Exemplo n.º 19
0
 public void evaluate() {
   try {
     // clear problems and console messages
     problemsView.setText("");
     consoleView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     tabbedPane.setSelectedIndex(0);
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Running ...");
     tabbedPane.setSelectedIndex(1);
     // update run button
     runButton.setIcon(stopImage);
     runButton.setActionCommand("Stop");
     // start run thread
     runThread = new RunThread(root);
     runThread.start();
   } catch (SyntaxError e) {
     tabbedPane.setSelectedIndex(0);
     System.err.println(
         "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage());
   } catch (Error e) {
     // parsing error
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
  /*
   * The following method creates the textfield to change the text
   *     and the button to update the label.
   * postcondition: returns the panel containing the textfield and button.
   */
  public JPanel createUpdateButton() {
    JLabel textLabel = new JLabel(new String("Change text to: "));

    textField = new JTextField(new String("Big Java"), 20);
    textField.setFont(new Font(("Times"), Font.PLAIN, 12));

    update = new JButton(new String("Update"));
    update.setDefaultCapable(true);

    // This class is used to create a special ActionListener for this menu item
    class ButtonListener implements ActionListener {
      /*
       * This method is called when the update button is clicked
       */
      public void actionPerformed(ActionEvent event) {
        // Call the method to change the text on the screen.
        setSampleFont();
      } // end actionPerformed method
    }
    ActionListener listener = new ButtonListener();
    update.addActionListener(listener);

    JPanel panel = new JPanel();

    panel.add(textLabel);
    panel.add(textField);
    panel.add(update);

    return panel;
  } // end createUpdateButton method
Exemplo n.º 21
0
  static void tell(String question, String btnText) {
    final JDialog d = new JDialog();
    d.setLocationRelativeTo(null);
    JPanel bpane = new JPanel(new FlowLayout());
    JLabel l = new JLabel(question);

    JPanel cp = (JPanel) d.getContentPane();

    cp.setLayout(new FlowLayout());
    cp.add(l, BorderLayout.CENTER);
    cp.add(bpane, BorderLayout.SOUTH);

    JButton b1 = new JButton("OK");
    bpane.add(b1);

    d.pack();

    d.setVisible(true);

    b1.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            ans = ((JButton) e.getSource()).getText();
            d.dispose();
          }
        });
  }
    private void addComponents() {
      this.setLayout(new BorderLayout());
      this.setSize(new Dimension(350, 200));
      // set display location
      Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
      this.setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);

      textArea = new JTextArea();
      textArea.setLineWrap(true);
      textArea.setEditable(false);
      textArea.setBorder(BorderFactory.createLineBorder(Color.gray));
      JScrollPane scrollPane =
          new JScrollPane(
              textArea,
              JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
              JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      scrollPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
      this.add(scrollPane, BorderLayout.CENTER);

      JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
      JButton closeButton = new JButton("Close");
      closeButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              PopupDialog.this.setVisible(false);
            }
          });
      buttonPanel.add(closeButton);
      this.add(buttonPanel, BorderLayout.SOUTH);
    }
Exemplo n.º 23
0
  public CollageList() {
    super();

    actionComponent = new Button();

    Panel toolBar;

    setLayout(new BorderLayout());
    //		ggHScroll	= new Scrollbar( Scrollbar.HORIZONTAL, 0, 0x8000, 0, 0x8000 );
    ggVScroll = new Scrollbar(Scrollbar.VERTICAL, 0, 0x8000, 0, 0x8000);
    //		ggHScroll.addAdjustmentListener( ggCurve );
    ggVScroll.addAdjustmentListener(this);

    toolBar = new Panel();
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2));
    ggAdd = new JButton("    Add    ");
    ggDel = new JButton("  Delete  ");
    ggDup = new JButton(" Duplicate ");
    ggAdd.addActionListener(this);
    ggDel.addActionListener(this);
    ggDup.addActionListener(this);
    toolBar.add(ggAdd);
    toolBar.add(ggDel);
    toolBar.add(ggDup);

    add(toolBar, BorderLayout.NORTH);
    //		add( ggHScroll, BorderLayout.SOUTH );
    add(ggVScroll, BorderLayout.EAST);
    add(new CollageCanvas(this), BorderLayout.CENTER);
    //		add( ggCurve,   BorderLayout.CENTER );
  }
 @Nullable
 @Override
 public JComponent createComponent() {
   myEnabled = new JBCheckBox("Enable EditorConfig support");
   final JPanel result = new JPanel();
   result.setLayout(new BoxLayout(result, BoxLayout.LINE_AXIS));
   final JPanel panel = new JPanel(new VerticalFlowLayout());
   result.setBorder(IdeBorderFactory.createTitledBorder("EditorConfig", false));
   panel.add(myEnabled);
   final JLabel warning = new JLabel("EditorConfig may override the IDE code style settings");
   warning.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
   warning.setBorder(IdeBorderFactory.createEmptyBorder(0, 20, 0, 0));
   panel.add(warning);
   panel.setAlignmentY(Component.TOP_ALIGNMENT);
   result.add(panel);
   final JButton export = new JButton("Export");
   export.addActionListener(
       (event) -> {
         final Component parent = UIUtil.findUltimateParent(result);
         if (parent instanceof IdeFrame) {
           Utils.export(((IdeFrame) parent).getProject());
         }
       });
   export.setAlignmentY(Component.TOP_ALIGNMENT);
   result.add(export);
   return result;
 }
    private void updateLook(JButton button) {
      ButtonModel model = button.getModel();
      boolean enabled = model.isEnabled();
      if (!enabled) {
        setLookNormal(button);
        return;
      }

      boolean pressed = model.isPressed();
      boolean selected = model.isSelected();
      if (pressed || selected) {
        setLookLowered(button);
        return;
      }

      if ((button == arrow) && popupVisible) {
        setLookLowered(button);
        return;
      }

      if (rollOver) {
        setLookRaised(button);
        return;
      }
      if (arrow.getModel().isSelected()) {
        setLookRaised(button);
        return;
      }
      setLookNormal(button);
    }
Exemplo n.º 26
0
  /**
   * builds and displays the frame without the colored fractal; registers the buttons; sets size,
   * location, close operation; calls changeFractal()
   */
  private void makeWindow() {

    // set size and location
    setSize(740, 800);
    setLocation(100, 0);

    // specify close button action
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // instantiate panel
    panelNorth = new JPanel();

    // instantiate buttons and register action listener
    up = new JButton("level up");
    down = new JButton("level down");
    up.addActionListener(this);
    down.addActionListener(this);

    // set layout
    setLayout(new BorderLayout(10, 10));

    // add panel to frame and buttons to panel
    add(panelNorth, BorderLayout.NORTH);
    panelNorth.add(up);
    panelNorth.add(down);

    // call changeFractal
    changeFractal();
  }
  public void actionPerformed(ActionEvent evt) {
    // Get button clicked
    JButton buttonClicked = (JButton) evt.getSource();
    String actionCommand = new String(buttonClicked.getActionCommand());

    if (actionCommand.equals("Submit")) {
      System.out.println(clientUser.getLogon() + ": updating ticket...");

      // Recover ticket and update it
      Ticket ticketToUpdate = ticket;
      ticketToUpdate.setDesc(clientTicketDialog.getSummaryDescriptionField());
      ticketToUpdate.setResolution(clientTicketDialog.getResolutionDescriptionField());

      // Call checkInTicket() on the RMI object to update the ticket on the server
      try {
        ticketServerObject.checkInTicket(ticketToUpdate);
        // Refresh the activeTickets HashMap
        owner.getActiveTickets();
      } catch (RemoteException re) {
        System.out.println(re.getMessage());
      }

      // Close the ClientTicketDialog
      clientTicketDialog.setVisible(false);
      clientTicketDialog.dispose();
    }
  }
Exemplo n.º 28
0
  /** {@inheritDoc} */
  public void setEnabled(boolean b) {
    if (b != isEnabled()) {
      super.setEnabled(b);

      if ((selectedComponents & DISPLAY_DATE) > 0) {
        yearDecrButton.setEnabled(b);
        monthDecrButton.setEnabled(b);
        monthYearLabel.setEnabled(b);
        monthIncrButton.setEnabled(b);
        yearIncrButton.setEnabled(b);

        for (int day = 0; day < 7; day++) {
          dayOfWeekLabels[day].setEnabled(b);
        }

        for (int row = 0; row < 6; row++) {
          for (int day = 0; day < 7; day++) {
            if (dayButtons[row][day].getText().length() > 0) {
              dayButtons[row][day].setEnabled(b);
            }
          }
        }
      }

      if ((selectedComponents & DISPLAY_TIME) > 0) {
        spinner.setEnabled(b);
      }
    }
  }
Exemplo n.º 29
0
  public CreInvChecker(Component parent) {
    typeButtons = new JCheckBox[CHECKTYPES.length];
    JPanel boxPanel = new JPanel(new GridLayout(0, 1));
    for (int i = 0; i < typeButtons.length; i++) {
      typeButtons[i] = new JCheckBox(CHECKTYPES[i], true);
      boxPanel.add(typeButtons[i]);
    }
    bstart.setMnemonic('s');
    bcancel.setMnemonic('c');
    bstart.addActionListener(this);
    bcancel.addActionListener(this);
    selectframe.getRootPane().setDefaultButton(bstart);
    selectframe.setIconImage(Icons.getIcon("Find16.gif").getImage());
    boxPanel.setBorder(BorderFactory.createTitledBorder("Select test to check:"));

    JPanel bpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    bpanel.add(bstart);
    bpanel.add(bcancel);

    JPanel mainpanel = new JPanel(new BorderLayout());
    mainpanel.add(boxPanel, BorderLayout.CENTER);
    mainpanel.add(bpanel, BorderLayout.SOUTH);
    mainpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

    JPanel pane = (JPanel) selectframe.getContentPane();
    pane.setLayout(new BorderLayout());
    pane.add(mainpanel, BorderLayout.CENTER);

    selectframe.pack();
    Center.center(selectframe, parent.getBounds());
    selectframe.setVisible(true);
  }
Exemplo n.º 30
0
 /** Method called by grid component each time a row is selected. */
 public void setLastRow(boolean isLastRecord) {
   lastButton.setEnabled(!isLastRecord);
   nextButton.setEnabled(!isLastRecord);
   nextPgButton.setEnabled(!isLastRecord);
   controlPageNr.setEnabled(true);
   //    controlPageNr.setEnabled(resultSetController.getTotalResultSetLength()!=-1);
 }