private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
예제 #2
0
  public void buildGUI() {
    theFrame = new JFrame("Cyber BeatBox");
    theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    BorderLayout layout = new BorderLayout();
    JPanel background = new JPanel(layout);
    background.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    checkboxList = new ArrayList<JCheckBox>();
    Box buttonBox = new Box(BoxLayout.Y_AXIS);

    JButton start = new JButton("Start");
    start.addActionListener(new MyStartListener());
    buttonBox.add(start);

    JButton stop = new JButton("Stop");
    stop.addActionListener(new MyStopListener());
    buttonBox.add(stop);

    JButton upTempo = new JButton("Tempo Up");
    upTempo.addActionListener(new MyUpTempoListener());
    buttonBox.add(upTempo);

    JButton downTempo = new JButton("Tempo Down");
    downTempo.addActionListener(new MyDownTempoListener());
    buttonBox.add(downTempo);

    Box nameBox = new Box(BoxLayout.Y_AXIS);
    for (int i = 0; i < 16; i++) {
      nameBox.add(new Label(instrumentNames[i]));
    }

    background.add(BorderLayout.EAST, buttonBox);
    background.add(BorderLayout.WEST, nameBox);

    theFrame.getContentPane().add(background);

    GridLayout grid = new GridLayout(16, 16);
    grid.setVgap(1);
    grid.setHgap(2);
    mainPanel = new JPanel(grid);
    background.add(BorderLayout.CENTER, mainPanel);

    for (int i = 0; i < 256; i++) {
      JCheckBox c = new JCheckBox();
      c.setSelected(false);
      checkboxList.add(c);
      mainPanel.add(c);
    } // end loop

    setUpMidi();

    theFrame.setBounds(50, 50, 300, 300);
    theFrame.pack();
    theFrame.setVisible(true);
  } // close method
예제 #3
0
  public CalculatorPanel() {

    result = 0;
    lastCommand = "+";
    ActionListener command = new CommandAction();

    GridLayout layout = new GridLayout(2, 5);
    layout.setHgap(5);
    layout.setVgap(5);

    panel = new JPanel();
    panel.setLayout(layout);
    panel.setPreferredSize(new Dimension(400, 200));

    // add display
    display = new JTextField();
    Command = new JTextField("+");
    firstNumber = new JTextField();
    secondNumber = new JTextField();
    JTextField equal = new JTextField("=");

    equal.setEnabled(false);
    display.setEnabled(false);
    Command.setEnabled(false);

    panel.add(firstNumber);
    panel.add(Command);
    panel.add(secondNumber);
    panel.add(equal);
    panel.add(display);

    addButton("+", command);
    addButton("-", command);
    addButton("*", command);
    addButton("/", command);
    addButton("OK", command);
    add(panel, BorderLayout.CENTER);
  }
예제 #4
0
  public ImportDialog(boolean targetIsARow, String fileName) {
    Boolean targetIsARow1 = targetIsARow;
    contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    setContentPane(contentPane);
    JPanel panel3 = new JPanel();
    panel3.setBackground(new Color(-1643275));
    JLabel labelHeadline = new JLabel(Localization.lang("Import_Metadata_from:"));
    labelHeadline.setFont(new Font(labelHeadline.getFont().getName(), Font.BOLD, 14));
    JLabel labelSubHeadline =
        new JLabel(Localization.lang("Choose_the_source_for_the_metadata_import"));
    labelSubHeadline.setFont(
        new Font(labelSubHeadline.getFont().getName(), labelSubHeadline.getFont().getStyle(), 13));
    JLabel labelFileName = new JLabel();
    labelFileName.setFont(new Font(labelHeadline.getFont().getName(), Font.BOLD, 14));
    JPanel headLinePanel = new JPanel();
    headLinePanel.add(labelHeadline);
    headLinePanel.add(labelFileName);
    headLinePanel.setBackground(new Color(-1643275));
    GridLayout gl = new GridLayout(2, 1);
    gl.setVgap(10);
    gl.setHgap(10);
    panel3.setLayout(gl);
    panel3.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    panel3.add(headLinePanel);
    panel3.add(labelSubHeadline);
    radioButtonNoMeta = new JRadioButton(Localization.lang("Create_blank_entry_linking_the_PDF"));
    radioButtonXmp = new JRadioButton(Localization.lang("Create_entry_based_on_XMP_data"));
    radioButtonPDFcontent = new JRadioButton(Localization.lang("Create_entry_based_on_content"));
    radioButtononlyAttachPDF = new JRadioButton(Localization.lang("Only_attach_PDF"));
    JButton buttonOK = new JButton(Localization.lang("Ok"));
    JButton buttonCancel = new JButton(Localization.lang("Cancel"));
    checkBoxDoNotShowAgain =
        new JCheckBox(Localization.lang("Do not show this box again for this import"));
    useDefaultPDFImportStyle =
        new JCheckBox(
            Localization.lang("Always use this PDF import style (and do not ask for each import)"));
    DefaultFormBuilder b =
        new DefaultFormBuilder(new FormLayout("left:pref, 5dlu, left:pref:grow", ""));
    b.appendSeparator(Localization.lang("Create New Entry"));
    b.append(radioButtonNoMeta, 3);
    b.append(radioButtonXmp, 3);
    b.append(radioButtonPDFcontent, 3);
    b.appendSeparator(Localization.lang("Update_Existing_Entry"));
    b.append(radioButtononlyAttachPDF, 3);
    b.nextLine();
    b.append(checkBoxDoNotShowAgain);
    b.append(useDefaultPDFImportStyle);
    b.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    ButtonBarBuilder bb = new ButtonBarBuilder();
    bb.addGlue();
    bb.addButton(buttonOK);
    bb.addButton(buttonCancel);
    bb.addGlue();
    bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    contentPane.add(panel3, BorderLayout.NORTH);
    contentPane.add(b.getPanel(), BorderLayout.CENTER);
    contentPane.add(bb.getPanel(), BorderLayout.SOUTH);

    if (!targetIsARow1) {
      this.radioButtononlyAttachPDF.setEnabled(false);
    }
    String name = new File(fileName).getName();
    if (name.length() < 34) {
      labelFileName.setText(name);
    } else {
      labelFileName.setText(new File(fileName).getName().substring(0, 33) + "...");
    }
    this.setTitle(Localization.lang("Import_Metadata_From_PDF"));

    setModal(true);
    getRootPane().setDefaultButton(buttonOK);

    // only one of the radio buttons may be selected.
    ButtonGroup bg = new ButtonGroup();
    bg.add(radioButtonNoMeta);
    bg.add(radioButtonXmp);
    bg.add(radioButtonPDFcontent);
    bg.add(radioButtononlyAttachPDF);

    buttonOK.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            onOK();
          }
        });

    buttonCancel.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            onCancel();
          }
        });

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {

          @Override
          public void windowClosing(WindowEvent e) {
            onCancel();
          }
        });

    contentPane.registerKeyboardAction(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            onCancel();
          }
        },
        KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    switch (Globals.prefs.getInt(ImportSettingsTab.PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE)) {
      case NOMETA:
        radioButtonNoMeta.setSelected(true);
        break;
      case XMP:
        radioButtonXmp.setSelected(true);
        break;
      case CONTENT:
        radioButtonPDFcontent.setSelected(true);
        break;
      case ONLYATTACH:
        radioButtononlyAttachPDF.setSelected(true);
        break;
      default:
        // fallback
        radioButtonPDFcontent.setSelected(true);
        break;
    }

    this.setSize(555, 371);
  }
예제 #5
0
  /** @param parent Parent Frame of this panel */
  public AdminView(tester parent) {
    padre = parent;
    try { // Start Setting the look and feel to nimbus
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception e) {
      // If Nimbus is not available, set gui to CrossPlatform
      try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
      } catch (ClassNotFoundException a) {
        // TODO Auto-generated catch block
      } catch (InstantiationException b) {
        // TODO Auto-generated catch block
      } catch (IllegalAccessException c) {
        // TODO Auto-generated catch block
      } catch (UnsupportedLookAndFeelException d) {
        // TODO Auto-generated catch block
      }
    }
    try { // start up the controller
      control = new Controller();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
    } catch (IOException e) {
      // TODO Auto-generated catch block
    }
    // make the panels
    JPanel total = new JPanel(new BorderLayout());
    JPanel test = new JPanel();
    JPanel users = new JPanel();
    JPanel info = new JPanel();
    // set any gaps i want
    Buttons.setVgap(10);
    Info.setHgap(20);
    // set layouts for the panels
    users.setLayout(List);
    test.setLayout(Buttons);
    info.setLayout(Info);
    // Set up the list
    listModel = new DefaultListModel<String>();
    userList = new JList<String>(listModel);
    userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // only one thing at a time
    userList.setVisibleRowCount(10);
    populateUsers();
    // userList.setPreferredSize(new Dimension(200,200));

    userList.setLayoutOrientation(JList.VERTICAL); // lists items vertically
    // put a scroll pane all up in
    JScrollPane userscroller =
        new JScrollPane(
            userList,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    userscroller.setPreferredSize(new Dimension(200, 200));

    // Initialize buttons
    add_user = new JButton("Add User");
    add_user.setPreferredSize(new Dimension(100, 20));
    delete_user = new JButton("Delete User");
    delete_user.setPreferredSize(new Dimension(100, 20));
    logout = new JButton("Logout");
    logout.setPreferredSize(new Dimension(100, 20));
    // add listeners
    add_user.addActionListener(this);
    add_user.setActionCommand("Add");
    delete_user.addActionListener(this);
    delete_user.setActionCommand("Delete");
    logout.addActionListener(this);
    logout.setActionCommand("Logout");
    // add to panels
    test.add(add_user);
    test.add(delete_user);
    test.add(logout);
    test.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10)); // spacing!
    users.add(userscroller);
    users.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 10)); // spacing!

    total.add(users); // everything is contained in total
    total.add(test, BorderLayout.WEST);
    total.setBorder(BorderFactory.createRaisedSoftBevelBorder()); // nice border
    total.setBorder(BorderFactory.createTitledBorder("Welcome Admin"));
    add(total);
  }
 public GraphPanel() {
   gridLayout.setHgap(2);
   gridLayout.setVgap(2);
   setLayout(gridLayout);
 }
예제 #7
0
  public FenetreAdministration(
      ListeUtilisateursImpl userlist, Utilisateur userConnected, File fileSave) {
    super("Application");

    this.userlist = userlist;
    this.userConnected = userConnected;
    this.fileSave = fileSave;

    JPanel main = new JPanel();
    main.setLayout(new BorderLayout());

    JMenuBar menubar = new JMenuBar();

    JMenu file = new JMenu("Fichier");
    JMenu gestion = new JMenu("Gestion");

    ajouter = new JMenuItem("Ajouter");
    supprimer = new JMenuItem("Supprimer");
    listeUtilisateurP3 = new JMenuItem("Lister les utilisateurs dans P3");
    listeUtilisateurP4 = new JMenuItem("Lister les utilisateurs dans P4");

    propos = new JMenuItem("A propos");
    quitter = new JMenuItem("Quitter");

    file.setMnemonic(KeyEvent.VK_F);
    gestion.setMnemonic(KeyEvent.VK_G);

    menubar.add(file);
    menubar.add(gestion);

    gestion.add(ajouter);
    gestion.add(supprimer);
    gestion.add(listeUtilisateurP3);
    gestion.add(listeUtilisateurP4);
    file.add(propos);
    file.add(quitter);

    setJMenuBar(menubar);

    GridLayout mainGrid = new GridLayout(2, 3);
    mainGrid.setHgap(15); // 5 pixels d'espace entre les colonnes (H comme Horizontal)
    mainGrid.setVgap(15); //
    main.setLayout(mainGrid);

    P1 = new PanelAjouter();
    P2 = new PanelSupprimer();
    P3 = new PanelListeUtilisateur();
    P4 = new PanelListeUtilisateur();
    JPanel P5 = new JPanel();
    JPanel P6 = new JPanel();

    P1.setLayout(new BorderLayout());
    P2.setLayout(new BorderLayout());
    P3.setLayout(new BorderLayout());
    P4.setLayout(new BorderLayout());
    P5.setLayout(new BorderLayout());
    P6.setLayout(new BorderLayout());

    TitledBorder titleNorthBorder = new TitledBorder("P1");
    titleNorthBorder.setTitleFont(new Font("Arial", Font.BOLD, 15));
    P1.setBorder(titleNorthBorder);

    P2.setBorder(BorderFactory.createLineBorder(Color.black));

    TitledBorder titleNorthBorder2 = new TitledBorder("P2");
    titleNorthBorder2.setTitleFont(new Font("Arial", Font.BOLD, 15));
    P2.setBorder(titleNorthBorder2);

    TitledBorder titleNorthBorder3 = new TitledBorder("P3");
    titleNorthBorder3.setTitleFont(new Font("Arial", Font.BOLD, 15));
    P3.setBorder(titleNorthBorder3);

    TitledBorder titleNorthBorder4 = new TitledBorder("P4");
    titleNorthBorder4.setTitleFont(new Font("Arial", Font.BOLD, 15));
    P4.setBorder(titleNorthBorder4);

    TitledBorder titleNorthBorder5 = new TitledBorder("P5");
    titleNorthBorder5.setTitleFont(new Font("Arial", Font.BOLD, 15));
    P5.setBorder(titleNorthBorder5);

    TitledBorder titleNorthBorder6 = new TitledBorder("P6");
    titleNorthBorder6.setTitleFont(new Font("Arial", Font.BOLD, 15));
    P6.setBorder(titleNorthBorder6);

    main.add(P1);
    main.add(P2);
    main.add(P3);
    main.add(P4);
    main.add(P5);
    main.add(P6);

    this.addWindowListener(new ListenerCloseWindow());
    ListenerAdministration buttonlistener = new ListenerAdministration(this);
    this.propos.addActionListener(buttonlistener);
    this.quitter.addActionListener(buttonlistener);
    this.ajouter.addActionListener(buttonlistener);
    this.supprimer.addActionListener(buttonlistener);

    this.listeUtilisateurP3.addActionListener(buttonlistener);
    this.listeUtilisateurP4.addActionListener(buttonlistener);

    this.setContentPane(main);
    this.setVisible(true);
    this.setSize(1200, 600);
  }
예제 #8
0
  private void jbInit() throws Exception {
    border1 = BorderFactory.createRaisedBevelBorder();
    jPanel1.setLayout(gridLayout1);
    panel2.setBorder(border1);
    panel2.setMaximumSize(new Dimension(400, 200));
    panel2.setMinimumSize(new Dimension(400, 200));
    panel2.setLayout(gridBagLayout2);
    button1.setText("OK");
    button1.addActionListener(new insertMapDialog_button1_actionAdapter(this));
    button2.setText("Cancel");
    gridLayout1.setHgap(4);
    button2.addActionListener(new insertMapDialog_button2_actionAdapter(this));
    this.addWindowListener(new insertMapDialog_this_windowAdapter(this));
    InsertMapPanel.setLayout(gridBagLayout1);
    upperLeftLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    upperLeftLabel.setText("Upper-left Hex:");
    headerLabel.setText("Please enter the hex where the upper-left ");
    upperLeftTextField.setText("A1");
    jLabel1.setText("corner of the selected map will be placed:");
    InsertMapPanel.add(
        jPanel1,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(4, 8, 4, 8),
            0,
            0));
    jPanel1.add(button1, null);
    jPanel1.add(button2, null);
    InsertMapPanel.add(
        panel2,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 2),
            0,
            0));
    panel2.add(
        upperLeftLabel,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(20, 118, 4, 12),
            88,
            5));
    panel2.add(
        headerLabel,
        new GridBagConstraints(
            0,
            0,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHEAST,
            GridBagConstraints.NONE,
            new Insets(-7, 186, 0, 156),
            69,
            12));
    panel2.add(
        upperLeftTextField,
        new GridBagConstraints(
            1,
            2,
            1,
            2,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(17, 0, 0, 0),
            65,
            0));
    panel2.add(
        jLabel1,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            new Insets(0, 16, 0, 0),
            225,
            0));
    getContentPane().add(InsertMapPanel);

    panel2.setPreferredSize(new Dimension(400, 200));
    this.validate();
  }