Пример #1
0
  //	public FenetreNouveauProduit(String[] lesCategories) {
  public FenetreNouveauProduit(ControleurGestionProduit ctrlGestionProduit) {

    gp = ctrlGestionProduit;

    setTitle("Creation Produit");
    setBounds(500, 500, 200, 250);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FlowLayout());

    JLabel labNom = new JLabel("Nom produit");
    JLabel labPrixHT = new JLabel("Prix Hors Taxe");
    JLabel labQte = new JLabel("Quantit� en stock");
    //		JLabel labCategorie = new JLabel("Categorie");
    contentPane.add(labNom);
    txtNom = new JTextField(15);
    contentPane.add(txtNom);
    contentPane.add(labPrixHT);
    txtPrixHT = new JTextField(15);
    contentPane.add(txtPrixHT);
    contentPane.add(labQte);
    txtQte = new JTextField(15);
    contentPane.add(txtQte);

    //		combo = new JComboBox<String>(lesCategories);
    //		combo.setPreferredSize(new Dimension(100, 20));
    //		contentPane.add(labCategorie);
    //		contentPane.add(combo);

    btValider = new JButton("Valider");
    contentPane.add(btValider);

    btValider.addActionListener(this);
    setVisible(true);
  }
Пример #2
0
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    jScrollPane1 = new JScrollPane();
    txtReport = new JTextPane();
    panel1 = new JPanel();
    btnCancel = new JButton();
    btnSave = new JButton();

    // ======== this ========
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            thisWindowClosing(e);
          }
        });
    Container contentPane = getContentPane();
    contentPane.setLayout(
        new FormLayout(
            "default, $lcgap, default:grow, $lcgap, default",
            "2*(default, $lgap), fill:default:grow, $lgap, fill:default, $lgap, default"));

    // ======== jScrollPane1 ========
    {
      jScrollPane1.setViewportView(txtReport);
    }
    contentPane.add(jScrollPane1, CC.xy(3, 5));

    // ======== panel1 ========
    {
      panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));

      // ---- btnCancel ----
      btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
      btnCancel.setText(null);
      btnCancel.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              btnCancelActionPerformed(e);
            }
          });
      panel1.add(btnCancel);

      // ---- btnSave ----
      btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
      btnSave.setText(null);
      btnSave.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              btnSaveActionPerformed(e);
            }
          });
      panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(3, 7, CC.RIGHT, CC.DEFAULT));
    setSize(462, 379);
    setLocationRelativeTo(null);
  } // </editor-fold>//GEN-END:initComponents
Пример #3
0
  public FenetrePrincipale(PlanSalle modele) {
    super();
    this.modele = modele;
    this.setTitle(modele.getNom() + " - OSE");
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.creerBarreMenus();
    this.creerMenuContextuel();
    JLayeredPane lp = new JLayeredPane();
    lp.setPreferredSize(
        new Dimension(
            Parametres.NB_TRAVEES * Parametres.LARGEUR_TRAVEE,
            Parametres.NB_RANGEES * Parametres.HAUTEUR_RANGEE));
    lePlan = new Plan(modele);
    lePlan.setBounds(
        0,
        0,
        Parametres.NB_TRAVEES * Parametres.LARGEUR_TRAVEE,
        Parametres.NB_RANGEES * Parametres.HAUTEUR_RANGEE);
    lp.add(lePlan, new Integer(0));
    Container conteneur = this.getContentPane();
    conteneur.setLayout(new FlowLayout());

    conteneur.add(lp);
    this.pack();
    this.setLocationRelativeTo(null);
    this.setVisible(true);
  }
Пример #4
0
  Customer() {

    super("Customer");
    Container con;
    con = this.getContentPane();
    con.setLayout(new FlowLayout());
    labelCustNo = new JLabel("Customer Number");
    labelCustName = new JLabel("Name");
    labelCustSex = new JLabel("Sex");
    labelCustAge = new JLabel("Age");
    // Initializing textfield
    textCustNo = new JTextField(20);
    textCustName = new JTextField(25);
    textCustAge = new JTextField(2);
    String Sex[] = {"Male", "Female"};
    comboCustSex = new JComboBox(Sex);
    // Adding controls for Customer Number
    con.add(labelCustNo);
    con.add(textCustNo);
    // Adding controls for Customer Name
    con.add(labelCustName);
    con.add(textCustName);
    // Adding controls for Customer Sex
    con.add(labelCustSex);
    con.add(comboCustSex);
    // Adding controls for Customer Age
    con.add(labelCustAge);
    con.add(textCustAge);
    // close the program when the close button is c l i c k e d
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(350, 250);
    show();
  }
  public static void addToPane(Container pane) {
    pane.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;

    c.gridy = 0;
    pane.add(input, c);
    c.gridy = 1;
    pane.add(output, c);
    c.gridy = 2;
    analyze.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            table = new HashTable();
            String toAnalyze = input.getText();
            Scanner in = new Scanner(toAnalyze);
            in.useDelimiter("[^\\p{Alpha}']+");
            while (in.hasNext()) {
              table.add(in.next().toLowerCase());
            }

            output.setText(table.toString());
            // output.setText("" + table.uniqueWords);
          }
        });
    pane.add(analyze, c);
  }
Пример #6
0
    public void actionPerformed(ActionEvent e) {
      if (elementTreeFrame == null) {
        // Create a frame containing an instance of
        // ElementTreePanel.
        try {
          String title = resources.getString("ElementTreeFrameTitle");
          elementTreeFrame = new JFrame(title);
        } catch (MissingResourceException mre) {
          elementTreeFrame = new JFrame();
        }

        elementTreeFrame.addWindowListener(
            new WindowAdapter() {

              @Override
              public void windowClosing(WindowEvent weeee) {
                elementTreeFrame.setVisible(false);
              }
            });
        Container fContentPane = elementTreeFrame.getContentPane();

        fContentPane.setLayout(new BorderLayout());
        elementTreePanel = new ElementTreePanel(getEditor());
        fContentPane.add(elementTreePanel);
        elementTreeFrame.pack();
      }
      elementTreeFrame.setVisible(true);
    }
  stab(ResultSet k) {
    super("PATIENT FOUND");
    String[] chd = {
      "Date",
      "Patient ID",
      "Name",
      "Gender",
      "Age",
      "Weight",
      "Address",
      "Contact No.",
      "Doctor Name",
      "Symptoms",
      "Dignosis",
      "Fee: Rs.",
      "Blood Group"
    };
    // DefaultTableModel dtm=new DefaultTableModel();
    // jt.setModel(new DefaultTableModel(arr,chd));
    jt = new JTable();
    jsp = new JScrollPane(jt);
    btn = new JButton("CLOSE");
    btn.addActionListener(this);
    int i = 0;

    try {
      while (k.next()) {

        arr[i][0] = k.getString(1);
        // System.out.println("ddddddddddddd"+arr[i][0]);
        arr[i][1] = "" + k.getInt(2);
        arr[i][2] = k.getString(3) + " " + k.getString(4) + " " + k.getString(5);
        arr[i][3] = k.getString(6);
        arr[i][4] = "" + k.getInt(7);
        arr[i][5] = k.getString(8);
        arr[i][6] = k.getString(9);
        arr[i][7] = k.getString(10);
        arr[i][8] = k.getString(11);
        arr[i][9] = k.getString(12);
        arr[i][10] = k.getString(13);
        arr[i][11] = "" + k.getInt(14);
        arr[i][12] = k.getString(15);
        arr[i][13] = k.getString(16);
        // dtm.insertRow(i,new Object[]{patient.rs.getString(1),
        // patient.rs.getInt(2),patient.rs.getString(3)+patient.rs.getString(4)+patient.rs.getString(5),patient.rs.getString(6),patient.rs.getInt(7),patient.rs.getString(8),patient.rs.getString(9),patient.rs.getString(10),patient.rs.getString(11),patient.rs.getString(12),patient.rs.getString(13),patient.rs.getInt(14)});
        i++;
      }
    } catch (Exception e12) {
      System.out.println("" + e12);
    }
    jt.setModel(new DefaultTableModel(arr, chd));
    Container con = getContentPane();
    con.setLayout(null);
    jsp.setBounds(20, 20, 1230, 600);
    btn.setBounds(685, 630, 100, 30);
    add(jsp);
    add(btn);
    setSize(1330, 800);
    setVisible(true);
  }
Пример #8
0
  /** *********************************************************************** */
  private static void createAndShowGUI() {
    JFrame.setDefaultLookAndFeelDecorated(true); // give JFrame nice decorations
    JFrame frame = new JFrame("Java GUI"); // create the JFrame
    frame.setDefaultCloseOperation(
        JFrame.EXIT_ON_CLOSE); // set up the JFrame to end the program when it closes
    Container c = frame.getContentPane();
    c.setLayout(new BorderLayout());

    ColorBars drawingPanel = new ColorBars(); // set up the panel to draw in
    drawingPanel.setBackground(Color.BLACK); // the the background to black

    drawingPanel.btnDraw = new JButton("Click me"); // instantiate a swing button
    drawingPanel.btnDraw.addActionListener(drawingPanel); // register the panel with the button
    drawingPanel.btnClear = new JButton("Clear Screen");
    drawingPanel.btnClear.addActionListener(drawingPanel);

    Panel buttonPanel = new Panel(); // instantiate the panel for buttons
    buttonPanel.add(drawingPanel.btnDraw); // add the swing button the the button panel
    buttonPanel.add(drawingPanel.btnClear);

    c.add(
        drawingPanel,
        BorderLayout.CENTER); // add the drawing panel to the frame (take up the entire frame)
    c.add(buttonPanel, BorderLayout.SOUTH); // add the button panel to the bottom of the frame

    frame.setExtendedState(JFrame.MAXIMIZED_BOTH); // set the window to maximized
    frame.setSize(600, 400); // set the frame size (in case user un-maximizes
    frame.setVisible(true); // display the frame
  }
Пример #9
0
  /* constructor
   * Create a frame with JTextArea and a menubar
   * with a "File" dropdown menu.
   *
   * @param title: the title for the frame
   * @param whichFile: to indicate which load or save buuton
   */
  public OpenFileDir(String title, String whichFile) {
    super(title);
    fileNo = whichFile;
    Container content_pane = getContentPane();

    // Create a user interface.
    content_pane.setLayout(new BorderLayout());

    // Use the helper method makeMenuItem
    // for making the menu items and registering
    // their listener.
    JMenu m = new JMenu("File");

    // Modify task names to something relevant to
    // the particular program.
    m.add(fMenuLoad = makeMenuItem("Load"));
    m.add(fMenuSave = makeMenuItem("Save"));
    m.add(fMenuClose = makeMenuItem("Quit"));

    JMenuBar mb = new JMenuBar();
    mb.add(m);

    setJMenuBar(mb);
    setSize(400, 200);
  } /* end of the constructor */
Пример #10
0
  /**
   * Set the value of content
   *
   * @param newVar the new value of content
   */
  private void setContent(final counts a, final connections cnc_a) {
    // Creates a new container
    content = frame.getContentPane();
    // sets the layout
    content.setLayout(new BorderLayout());

    this.setTaskbar(); // sets the taskbar
    // adding the taskbar to the bottom-part
    content.add(taskbar, BorderLayout.SOUTH);

    this.setDraw_pad(a, cnc_a, this.getTaskbar()); // sets the drawPad
    JScrollPane Padscroller = new JScrollPane();
    Padscroller.setWheelScrollingEnabled(true);
    Padscroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    Padscroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    Padscroller.setPreferredSize(new Dimension(200, 100));
    // Padscroller.setMinimumSize(new Dimension(200, 100));
    // Padscroller.setMaximumSize(new Dimension(200, 100));
    Padscroller.setViewportView(drawPad);
    content.add(Padscroller, BorderLayout.CENTER);

    this.setPanel(a, cnc_a); // sets the panel
    JScrollPane scroller = new JScrollPane(panel);
    scroller.setWheelScrollingEnabled(true);
    scroller.setPreferredSize(new Dimension(125, 80));
    scroller.setMinimumSize(new Dimension(125, 80));
    scroller.setMaximumSize(new Dimension(125, 80));
    // sets the scroller to the west portion
    content.add(scroller, BorderLayout.WEST);
    // content.add(panel, BorderLayout.WEST);
  }
Пример #11
0
  public void init() {

    // <Begin_init>
    if (initialized == true) return;
    this.setSize(getPreferredSize().width + 682, getPreferredSize().height + 419);
    setTitle(NmsClientUtil.GetString("Router Display Panel"));
    Container container = getContentPane();
    container.setLayout(new BorderLayout());
    try {
      initVariables();
      setUpGUI(container);
      setUpProperties();
      setUpConnections();
    } catch (Exception ex) {
      showStatus(NmsClientUtil.GetString("Error in init method"), ex);
    }
    // let us set the initialzed variable to true so
    // we dont initialize again even if init is called
    initialized = true;
    setUpMenus();
    setUpToolBar();

    // <End_init>
    setIconImage(NmsClientUtil.getFrameIcon());
  }
Пример #12
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);

  }
Пример #13
0
  public MixingColors() {
    super("Selecting a color");
    contents = getContentPane();
    contents.setLayout(new FlowLayout());

    red = new JCheckBox("red");
    green = new JCheckBox("green");
    blue = new JCheckBox("blue");

    label = new JLabel("Watch my background");
    label.setOpaque(true);
    label.setForeground(Color.GRAY);
    label.setBackground(new Color(0, 0, 0));

    contents.add(red);
    contents.add(green);
    contents.add(blue);
    contents.add(label);

    // create CheckBoxHandler event handler
    // and register it on the checkboxes
    CheckBoxHandler cbh = new CheckBoxHandler();
    red.addItemListener(cbh);
    green.addItemListener(cbh);
    blue.addItemListener(cbh);

    setSize(225, 200);
    setVisible(true);
  }
  public Welcome() {
    c.setLayout(null);

    c.add(welcome);
    welcome.setBounds(250, 100, 600, 50);
    welcome.setFont(font1);
    welcome.setForeground(Color.black);

    c.add(hotel);
    hotel.setBounds(350, 170, 700, 50);
    hotel.setFont(font2);
    hotel.setForeground(Color.black);

    c.add(check);
    check.setBounds(450, 350, 250, 50);
    check.addActionListener(this);

    c.add(order);
    order.setBounds(150, 350, 250, 50);
    order.addActionListener(this);

    c.add(bill);
    bill.setBounds(750, 350, 250, 50);
    bill.addActionListener(this);

    c.add(exit);
    exit.setBounds(40, 600, 130, 20);
    exit.addActionListener(this);

    c.add(back).setBounds(0, 0, 1800, 1000);
  }
Пример #15
0
  // Constructor
  public FileWindow() {

    myWindow = new JFrame("New File");
    myWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    Container contentPane = myWindow.getContentPane();
    contentPane.setLayout(new BorderLayout());

    saveButton = new JButton("Save File");
    saveButton.setSelected(false);
    saveButton.setActionCommand("save");
    saveButton.setMnemonic('S');
    // saveButton.addActionListener(new ScriptWindowButtonListener());

    clearButton = new JButton("Clear Contents");
    clearButton.setSelected(false);
    clearButton.setActionCommand("clear");
    clearButton.setMnemonic('B');
    clearButton.addActionListener(new ScriptWindowButtonListener());

    cancelButton = new JButton("Quit");
    cancelButton.setSelected(false);
    cancelButton.setActionCommand("quit");
    cancelButton.setMnemonic('Q');
    cancelButton.addActionListener(new ScriptWindowButtonListener());

    //		loadButton = new JButton("Load Script");
    //		loadButton.setSelected(false);
    //		loadButton.setActionCommand("load");
    //		loadButton.setMnemonic('L');
    //		loadButton.addActionListener(new ScriptWindowButtonListener());
    //
    //		runButton = new JButton("Run Script");
    //		runButton.setSelected(false);
    //		runButton.setActionCommand("run");
    //		runButton.setMnemonic('L');
    //		runButton.addActionListener(new ScriptWindowButtonListener());

    buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(1, 0));
    // buttonPanel.add(runButton);
    buttonPanel.add(saveButton);
    // buttonPanel.add(loadButton);
    buttonPanel.add(clearButton);
    // buttonPanel.add(cancelButton);

    fileChooser = new JFileChooser();

    scriptArea = new JTextArea(35, 30);
    JScrollPane scroller = new JScrollPane(scriptArea);

    textHolder = new JPanel();
    textHolder.setLayout(new BorderLayout());
    textHolder.add(scroller, BorderLayout.CENTER);

    contentPane.add(buttonPanel, BorderLayout.NORTH);
    contentPane.add(textHolder, BorderLayout.CENTER);
    myWindow.pack();
  }
Пример #16
0
  /**
   * Displays a custom file chooser sheet with a custom approve button.
   *
   * @param chooser the chooser
   * @param parent the parent component of the dialog; can be {@code null}
   * @param approveButtonText the text of the {@code ApproveButton}
   * @param listener The listener for SheetEvents.
   */
  public static void showSheet(
      final JFileChooser chooser,
      Component parent,
      String approveButtonText,
      SheetListener listener) {
    if (approveButtonText != null) {
      chooser.setApproveButtonText(approveButtonText);
      chooser.setDialogType(JFileChooser.CUSTOM_DIALOG);
    }

    // Begin Create Dialog
    Frame frame =
        parent instanceof Frame
            ? (Frame) parent
            : (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);

    String title = chooser.getUI().getDialogTitle(chooser);
    chooser.getAccessibleContext().setAccessibleDescription(title);

    final JSheet sheet = new JSheet(frame);
    sheet.addSheetListener(listener);

    Container contentPane = sheet.getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(chooser, BorderLayout.CENTER);
    // End Create Dialog

    final ActionListener actionListener =
        new ActionListener() {

          public void actionPerformed(ActionEvent evt) {
            int option;
            if (evt.getActionCommand().equals("ApproveSelection")) {
              option = JFileChooser.APPROVE_OPTION;
            } else {
              option = JFileChooser.CANCEL_OPTION;
            }
            sheet.hide();
            sheet.fireOptionSelected(chooser, option);
            chooser.removeActionListener(this);
          }
        };
    chooser.addActionListener(actionListener);
    sheet.addWindowListener(
        new WindowAdapter() {

          @Override
          public void windowClosing(WindowEvent e) {
            sheet.fireOptionSelected(chooser, JFileChooser.CANCEL_OPTION);
            chooser.removeActionListener(actionListener);
          }
        });
    chooser.rescanCurrentDirectory();
    sheet.pack();
    sheet.show();
    sheet.toFront();
  }
Пример #17
0
  public DistributedTextEditor() {
    area1.setFont(new Font("Monospaced", Font.PLAIN, 12));

    area2.setFont(new Font("Monospaced", Font.PLAIN, 12));
    ((AbstractDocument) area1.getDocument()).setDocumentFilter(dec);
    area2.setEditable(false);

    Container content = getContentPane();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    JScrollPane scroll1 =
        new JScrollPane(
            area1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    content.add(scroll1, BorderLayout.CENTER);

    JScrollPane scroll2 =
        new JScrollPane(
            area2, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    content.add(scroll2, BorderLayout.CENTER);

    content.add(ipaddress, BorderLayout.CENTER);
    content.add(portNumber, BorderLayout.CENTER);

    JMenuBar JMB = new JMenuBar();
    setJMenuBar(JMB);
    JMenu file = new JMenu("File");
    JMenu edit = new JMenu("Edit");
    JMB.add(file);
    JMB.add(edit);

    file.add(Listen);
    file.add(Connect);
    file.add(Disconnect);
    file.addSeparator();
    file.add(Save);
    file.add(SaveAs);
    file.add(Quit);

    edit.add(Copy);
    edit.add(Paste);
    edit.getItem(0).setText("Copy");
    edit.getItem(1).setText("Paste");

    Save.setEnabled(false);
    SaveAs.setEnabled(false);
    Disconnect.setEnabled(false);

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    area1.addKeyListener(k1);
    area1.addMouseListener(m1);
    setTitle("Disconnected");
    setVisible(true);
    area1.insert("Welcome to Hjortehandlerne's distributed text editor. \n", 0);

    this.addWindowListener(w1);
  }
Пример #18
0
 public static void main(String[] argv) throws NoSuchMethodException {
   f = new JFrame();
   Container c = f.getContentPane();
   c.setLayout(new BorderLayout());
   c.add(new WordListScreen(null), BorderLayout.CENTER);
   f.pack();
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   showFrame(true);
 }
Пример #19
0
 public void init() {
   b1.addActionListener(bl);
   b2.addActionListener(bl);
   Container cp = getContentPane();
   cp.setLayout(new FlowLayout());
   cp.add(b1);
   cp.add(b2);
   cp.add(txt);
 }
Пример #20
0
  public D(String title) {
    super(title);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    int frameWidth = 410;
    int frameHeight = 319;
    setSize(frameWidth, frameHeight);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (d.width - getSize().width) / 2;
    int y = (d.height - getSize().height) / 2;
    setLocation(x, y);
    setResizable(false);
    Container cp = getContentPane();
    cp.setLayout(null);

    label1.setBounds(8, 8, 275, 76);
    label1.setText("Würfel");
    label1.setAlignment(Label.CENTER);
    label1.setFont(new Font("Dialog", Font.PLAIN, 60));
    cp.add(label1);
    l_1.setBounds(8, 88, 275, 145);
    l_1.setText("");
    l_1.setAlignment(Label.CENTER);
    l_1.setFont(new Font("Dialog", Font.PLAIN, 100));

    cp.add(l_1);
    b_1.setBounds(8, 248, 275, 25);
    b_1.setLabel("Würfeln");
    b_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            b_1_ActionPerformed(evt);
          }
        });
    cp.add(b_1);
    tf_von.setBounds(336, 80, 49, 25);
    cp.add(tf_von);
    tf_bis.setBounds(336, 120, 49, 25);
    cp.add(tf_bis);
    l_von.setBounds(296, 80, 35, 25);
    l_von.setText("Von:");
    cp.add(l_von);
    l_bis.setBounds(296, 120, 35, 25);
    l_bis.setText("Bis:");
    cp.add(l_bis);
    b_a.setBounds(296, 160, 89, 49);
    b_a.setLabel("Annehmen");
    b_a.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            b_a_ActionPerformed(evt);
          }
        });
    cp.add(b_a);

    setVisible(true);
  }
Пример #21
0
 public FenBoutDyn() {
   setTitle("Boutons dynamiques");
   setSize(500, 150);
   Container contenu = getContentPane();
   contenu.setLayout(new FlowLayout());
   crBouton = new JButton("CREATION BOUTON");
   contenu.add(crBouton);
   EcoutCr ecoutCr = new EcoutCr(contenu);
   crBouton.addActionListener(ecoutCr);
 }
Пример #22
0
 public Frame() {
   super("première fenêtre");
   this.addWindowListener(this);
   Container content = this.getContentPane();
   content.setLayout(new BorderLayout());
   content.add(new BoutonBonjour(), BorderLayout.CENTER);
   this.pack();
   this.setVisible(true);
   this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
 }
Пример #23
0
 public noughtsandcrosses() {
   TFrame = new JFrame();
   Container con = this.getContentPane();
   con.setLayout(new GridLayout(3, 0));
   for (int i = 0; i < tArray.length; i++) {
     tArray[i] = new JButton("");
     con.add(tArray[i]);
     tArray[i].addActionListener(this);
   }
 }
Пример #24
0
  public void initComponents() {
    /** ******************** The main container *************************** */
    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());
    container.setBackground(Color.black);
    this.setSize(650, 600);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {}
        });

    /** ************************* MAIN PANEL ******************************* */
    mainPanel = new JPanel();
    // If put to False: we see the container's background
    mainPanel.setOpaque(false);
    mainPanel.setLayout(new BorderLayout());
    container.add(mainPanel, BorderLayout.CENTER);

    allmessagesTextArea = new TextArea();
    allmessagesTextArea.setEditable(false);
    allmessagesTextArea.setFont(new Font("Dialog", 1, 12));
    allmessagesTextArea.setForeground(Color.black);
    allmessagesTextArea.append("Select a session in the list to view its messages");
    mainPanel.add(allmessagesTextArea, BorderLayout.CENTER);

    sessionsList = new List();
    sessionsList.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            showMessages(e);
          }
        });
    sessionsList.setForeground(Color.black);
    sessionsList.setFont(new Font("Dialog", 1, 14));
    mainPanel.add(sessionsList, BorderLayout.WEST);

    okButton = new JButton("  OK  ");
    okButton.setToolTipText("Returns to the main frame");
    okButton.setFont(new Font("Dialog", 1, 16));
    okButton.setFocusPainted(false);
    okButton.setBackground(Color.lightGray);
    okButton.setBorder(new BevelBorder(BevelBorder.RAISED));
    okButton.setVerticalAlignment(SwingConstants.CENTER);
    okButton.setHorizontalAlignment(SwingConstants.CENTER);
    container.add(okButton, BorderLayout.SOUTH);
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            setVisible(false);
          }
        });
  }
Пример #25
0
  /**
   * Cr�e une nouvelle instance de CreeTrans
   *
   * @param mf fenetre principale de l'application
   * @param zg Zone graphique
   * @param auto automate
   * @param be barre d'�tat
   */
  public TransCreator(MainFrame mf, GraphicZone g, Automate auto, StateBar be) {

    super(JOptionPane.getFrameForComponent(mf), "Creating interaction", true);

    this.setResizable(false);

    this.gz = g;
    this.auto = auto;
    this.bar = be;
    this.mf = mf;

    be.displayInfo("Creating interaction");

    tfJPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel1.setBackground(Color.lightGray);
    tfJPanel1.add(new JLabel("Type  : "));
    groupe = new CheckboxGroup();
    plus = new Checkbox("activator", groupe, true);
    tfJPanel1.add(plus);
    minus = new Checkbox("inhibitor", groupe, false);
    tfJPanel1.add(minus);

    tfJPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel2.setBackground(Color.lightGray);
    tfJPanel2.add(new JLabel("Threshold  = "));
    tf = new JTextField(auto.nbrCharTransLabel);
    tf.setText("1");
    tfJPanel2.add(tf);

    btJPanel = new JPanel(new GridLayout(1, 2, 0, 0));
    btJPanel.setBackground(Color.lightGray);
    ok = new Button("Ok");
    ok.setBackground(Color.lightGray);
    ok.addActionListener(this);
    cancel = new Button("Cancel");
    cancel.setBackground(Color.lightGray);
    cancel.addActionListener(this);
    btJPanel.add(ok);
    btJPanel.add(cancel);

    content = this.getContentPane();
    content.setLayout(new BorderLayout());
    content.setBackground(Color.lightGray);
    content.add(tfJPanel1, BorderLayout.NORTH);
    content.add(tfJPanel2, BorderLayout.CENTER);
    content.add(btJPanel, BorderLayout.SOUTH);

    this.pack();
    this.setLocationRelativeTo(this.mf);

    tf.requestFocusInWindow();

    // rendre la fenetre visible
    setVisible(true);
  }
Пример #26
0
 MyDesktop() {
   // fr1 = new JInternalFrame("FlowLayout", true, true);
   fr1.setBounds(10, 10, 150, 150);
   Container c = fr1.getContentPane();
   c.setLayout(new FlowLayout());
   c.add(new JButton("1"));
   c.add(new JButton("2"));
   c.add(new JButton("3"));
   c.add(new JButton("4"));
   add(fr1, 0);
 }
Пример #27
0
  public static void main(String args[]) {

    JFrame f = new JFrame("JPasswordField3");
    Container contentPane = f.getContentPane();
    contentPane.setLayout(new BorderLayout());

    JPanel p1 = new JPanel();
    // p1.setLayout(new GridLayout(4,2));
    p1.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST; // 设定Layout的位置
    gbc.insets = new Insets(2, 2, 2, 2); // 设定与边界的距离(上,左,下,右)

    p1.setBorder(BorderFactory.createTitledBorder("您的基本数据"));
    JLabel l1 = new JLabel("姓名:");
    JLabel l2 = new JLabel("性别:");
    JLabel l3 = new JLabel("身高:");
    JLabel l4 = new JLabel("体重:");
    JPasswordField t1 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(10), "", 10);
    JPasswordField t2 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(1), "", 2);
    JPasswordField t3 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(5), "", 5);
    JPasswordField t4 = new JPasswordField(new JPasswordField3_OnlyNumberDocument(5), "", 5);

    gbc.gridy = 1;
    gbc.gridx = 0;
    p1.add(l1, gbc);
    gbc.gridx = 1;
    p1.add(t1, gbc);
    gbc.gridy = 2;
    gbc.gridx = 0;
    p1.add(l2, gbc);
    gbc.gridx = 1;
    p1.add(t2, gbc);
    gbc.gridy = 3;
    gbc.gridx = 0;
    p1.add(l3, gbc);
    gbc.gridx = 1;
    p1.add(t3, gbc);
    gbc.gridy = 4;
    gbc.gridx = 0;
    p1.add(l4, gbc);
    gbc.gridx = 1;
    p1.add(t4, gbc);

    contentPane.add(p1);
    f.pack();
    f.show();
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
Пример #28
0
  public void start() {
    frame = new JFrame("Multiple Components");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new BorderLayout());

    // Label for instructions
    label = new JLabel("Use the buttons to control the layout of text");
    contentPane.add(label, BorderLayout.NORTH);

    // West panel
    westpanel = new JPanel();
    westpanel.setLayout(new BoxLayout(westpanel, BoxLayout.Y_AXIS));

    buttonwrap = new JButton("Wrap Text       ");
    buttonwrap.addActionListener(this);
    westpanel.add(buttonwrap);
    buttonDoNotWrap = new JButton("Do Not Wrap Text");
    buttonDoNotWrap.addActionListener(this);
    westpanel.add(buttonDoNotWrap);
    buttonBlank = new JButton("                ");
    buttonBlank.addActionListener(this);
    westpanel.add(buttonBlank);
    buttonClearText = new JButton("Clear Text     ");
    buttonClearText.addActionListener(this);
    westpanel.add(buttonClearText);
    contentPane.add(westpanel, BorderLayout.WEST);

    // Text area
    textArea = new JTextArea(10, 25);
    scrollArea = new JScrollPane(textArea);
    contentPane.add(scrollArea, BorderLayout.CENTER);

    // East panel to control scroll bars
    eastpanel = new JPanel();
    eastpanel.setLayout(new BoxLayout(eastpanel, BoxLayout.Y_AXIS));

    buttonScrollV = new JButton("Scroll Vertically");
    buttonScrollV.addActionListener(this);
    eastpanel.add(buttonScrollV);
    buttonScrollH = new JButton("Scroll Horizontally");
    buttonScrollH.addActionListener(this);
    eastpanel.add(buttonScrollH);
    buttonScrollBothWays = new JButton("Scroll Both Ways");
    buttonScrollBothWays.addActionListener(this);
    eastpanel.add(buttonScrollBothWays);
    buttonDoNotScroll = new JButton("Do Not Scroll");
    buttonDoNotScroll.addActionListener(this);
    eastpanel.add(buttonDoNotScroll);
    contentPane.add(eastpanel, BorderLayout.EAST);

    frame.pack();
    frame.setVisible(true);
  }
Пример #29
0
 public FenBoutonsDyn() {
   setTitle("Activation/Desactivation");
   setSize(500, 150);
   Container contenu = getContentPane();
   contenu.setLayout(new FlowLayout());
   tabBout = new JButton[NBOUTONS];
   for (int i = 0; i < NBOUTONS; i++) {
     tabBout[i] = new JButton("BOUTON" + i);
     contenu.add(tabBout[i]);
     tabBout[i].addActionListener(this);
   }
 }
 public AutoAnalize() {
   Container vidus = getContentPane();
   vidus.setLayout(new BoxLayout(vidus, BoxLayout.Y_AXIS));
   vidus.add(panAutoSąr);
   vidus.add(panDuomenys);
   jbReg.addActionListener(this);
   //        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   išdėstymas();
   kosmetika();
   setVisible(true);
   pack();
 }