예제 #1
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);
  }
예제 #2
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();
  }
예제 #3
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);
  }
예제 #4
0
파일: OpenFileDir.java 프로젝트: NCIP/dwd
  /* 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 */
예제 #5
0
  /** Creates new form display window */
  public PZWindow(
      final PZManager manager,
      int screenX,
      int screenY,
      int width,
      int height,
      int drawX,
      int drawY) {
    this.manager = manager;
    java.net.URL url = ClassLoader.getSystemClassLoader().getResource("images/dgu.gif");
    if (url != null) setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage(url));

    setBounds(screenX, screenY, width, height);
    setMySize(width, height, 1.0f);

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    // setup the canvas for the window to draw
    final Container cp = getContentPane();
    cp.setLayout(null);
    cp.add(lblCanvas);
    lblCanvas.setBorder(BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
    lblCanvas.setDoubleBuffered(true);
    lblCanvas.setFocusable(true);

    initEventListeners();
    drawOffset.set(drawX, drawY);
  }
예제 #6
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);
  }
예제 #7
0
파일: About.java 프로젝트: annsofi/kalken
  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);

  }
예제 #8
0
  UserInputValidationErrorBox(Frame parent, YWorkItem item, YDataStateException e) {
    super(parent, "Problem with your input data");
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    JPanel p = new JPanel(new BorderLayout());
    p.setBackground(YAdminGUI._apiColour);
    p.add(createTopPanel(item), BorderLayout.NORTH);
    p.add(createCentrePanel(e), BorderLayout.CENTER);
    c.add(p, BorderLayout.CENTER);
    c.add(createBottomPanel(), BorderLayout.SOUTH);
    c.setBackground(YAdminGUI._apiColour);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            storeData();
            this_windowClosing();
          }
        });

    Double screenWidth =
        new Double(
            GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth());
    Double screenHeight =
        new Double(
            GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight());
    setSize(new Double(screenWidth * 0.8).intValue(), new Double(screenHeight * 0.8).intValue());

    Dimension labelSize = this.getSize();
    setLocation(
        screenWidth.intValue() / 2 - (labelSize.width / 2),
        screenHeight.intValue() / 2 - (labelSize.height / 2));
    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);
  }
예제 #10
0
파일: GUI.java 프로젝트: raunM/mazegame
  @Override
  public void launchGame() {
    int numRows = game.getNumRows();
    int numCols = game.getNumCols();

    Container c = this.getContentPane();
    c.setLayout(new GridLayout(numRows, numCols));
    tile = new JLabel[numRows][numCols];

    GUIListener listener = new GUIListener(this);
    this.addKeyListener(listener);

    for (int i = 0; i < numRows; i++) {
      for (int j = 0; j < numCols; j++) {
        tile[i][j] = new JLabel();
        tile[i][j].setText("" + game.get(i, j).toString());
        tile[i][j].setFont(new Font(null, Font.BOLD, 18));
        tile[i][j].setHorizontalAlignment(SwingConstants.CENTER);
        tile[i][j].setVerticalAlignment(SwingConstants.CENTER);
        c.add(tile[i][j]);
      }
    }
    setVisible(true);
    pack();
  }
예제 #11
0
 /**
  * Introduce the Scout449 program!
  *
  * @param stat the Scout449 responsible for this object
  */
 public Intro(Scout449 stat) {
   super("Loading Scout449");
   setVisible(false);
   setUndecorated(true);
   setIconImage(stat.getImage("winicon"));
   loadImage();
   getRootPane().putClientProperty("Window.shadow", Boolean.FALSE);
   setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
   Container c = getContentPane();
   c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));
   c.add(Box.createVerticalGlue());
   Loading load = new Loading();
   load.setOpaque(true);
   load.setAlignmentX(JComponent.CENTER_ALIGNMENT);
   c.add(load);
   setCursor(Constants.WAIT);
   c.add(Box.createVerticalGlue());
   // center the window
   Dimension ss = AppLib.winInfo.getScreenSize();
   setBounds(
       (ss.width - Constants.INTRO_WIDTH) / 2,
       (ss.height - Constants.INTRO_HEIGHT) / 2,
       Constants.INTRO_WIDTH,
       Constants.INTRO_HEIGHT);
   setVisible(true);
 }
예제 #12
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
예제 #13
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());
  }
  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
  public MsnTreeTest() {
    String[] tab = {"hello", "test", "blabla"};

    container = getContentPane();
    container.setLayout(null);

    eleve = new DefaultMutableTreeNode("MSN");

    worker = new DefaultMutableTreeNode("Worker");
    prof = new DefaultMutableTreeNode("Profs");

    for (int i = 0; i < tab.length; i++) {
      worker.add(new DefaultMutableTreeNode(tab[i]));
      prof.add(new DefaultMutableTreeNode(tab[i]));
    }
    //        worker.add(new DefaultMutableTreeNode("hello world2"));

    eleve.add(worker);
    eleve.add(prof);

    tree = new JTree(eleve);

    scroll = new JScrollPane(tree);
    scroll.setBounds(10, 10, 100, 100);

    container.add(scroll);

    setSize(300, 300);
    setLocation(200, 200);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setVisible(true);

    //        worker.add(n);

  }
예제 #16
0
  public static void main(String[] args) {
    Toolkit theKit = aWindow.getToolkit(); // Get the window Toolkit
    Dimension wndSize = theKit.getScreenSize(); // Get the screen size

    // Set the position to screen center & size to half screen size
    aWindow.setBounds(
        wndSize.width / 4,
        wndSize.height / 4, // Position
        wndSize.width / 2,
        wndSize.height / 2); // Size
    aWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    GridLayout grid = new GridLayout(5, 2, 30, 20); // Create a layout manager
    Container content = aWindow.getContentPane();
    content.setLayout(grid);

    EtchedBorder edge = new EtchedBorder(EtchedBorder.RAISED); // Button border

    // Now add ten Button compenents
    JButton button;
    for (int i = 1; i <= 10; i++) {
      content.add(button = new JButton("Press " + i));
      button.setBorder(edge);
    }

    aWindow.getContentPane().setBackground(new Color(238, 233, 233));
    aWindow.setVisible(true);
  }
예제 #17
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);
  }
예제 #19
0
  public static void main(String[] args) {
    JFrame frame = new JFrame("Add");
    frame.setLocation(500, 400);
    //		frame.setPreferredSize(new Dimension(250, 100));
    Container contentPane = frame.getContentPane();

    FlowLayout layout = new FlowLayout();
    contentPane.setLayout(layout);
    JPanel panel = new JPanel();
    panel.add(new JTextField(6));
    panel.add(new JLabel("+"));
    panel.add(new JTextField(6));
    panel.add(new JLabel("="));
    panel.add(new JTextField(6));

    contentPane.add(panel, BorderLayout.CENTER);

    JPanel panel2 = new JPanel();
    panel2.add(new JButton("확인"));
    panel2.add(new JButton("취소"));
    contentPane.add(panel2, BorderLayout.SOUTH);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
  }
예제 #20
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);
  }
예제 #21
0
  private void setupUsernameRequestView() {
    PANEL = new JPanel();
    PANEL.setBackground(Color.BLACK);
    userName = new CstmTextField("", "Enter your name");
    enter = new CstmButton("ENTER");
    userNameLabel = new CstmLabel("USER NAME", SwingConstants.CENTER);
    serverTalkLabel = new CstmLabel("", SwingConstants.CENTER);
    PANEL.setLayout(new BoxLayout(PANEL, BoxLayout.Y_AXIS));
    userName.setPreferredSize(new Dimension(200, 30));
    userName.setAlignmentX(Component.CENTER_ALIGNMENT);
    enter.setPreferredSize(new Dimension(200, 30));
    enter.setAlignmentX(Component.CENTER_ALIGNMENT);
    serverTalkLabel.setPreferredSize(new Dimension(450, 30));
    serverTalkLabel.setAlignmentX(Component.CENTER_ALIGNMENT);

    enter.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            CHAT_CLIENT.chatNameRequest(userName.getText().trim());
          }
        });
    userNameLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
    PANEL.add(userNameLabel);
    PANEL.add(userName);
    PANEL.add(enter);
    PANEL.add(serverTalkLabel);
    Container container = getContentPane();
    container.setLayout(new GridBagLayout());
    container.add(PANEL, new GridBagConstraints());
    container.setBackground(Color.BLACK);
    pack();
    setVisible(true);
  }
예제 #22
0
  private void setupGui() {
    setIconImage(
        Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/image/logo_ftb.png")));
    setTitle(I18N.getLocaleString("UPDATEMODPACK_TITLE"));
    setResizable(true);

    Container panel = getContentPane();
    panel.setLayout(new MigLayout());

    messageLbl = new JLabel(I18N.getLocaleString("UPDATEMODPACK_ISAVALIBLE"));
    updateLbl = new JLabel(I18N.getLocaleString("UPDATE_WICHUPDATE"));
    backupCFG = new JCheckBox(I18N.getLocaleString("UPDATEMODPACK_BACKUPCFG"));
    backupSave = new JCheckBox(I18N.getLocaleString("UPDATEMODPACK_BACKUPSAVE"));
    update = new JButton(I18N.getLocaleString("MAIN_YES"));
    abort = new JButton(I18N.getLocaleString("MAIN_NO"));

    panel.add(messageLbl, GuiConstants.WRAP);
    panel.add(updateLbl, GuiConstants.WRAP);
    panel.add(backupCFG, GuiConstants.CENTER_SINGLE_LINE);
    panel.add(backupSave, GuiConstants.CENTER_SINGLE_LINE);
    panel.add(update, GuiConstants.CENTER_TWO);
    panel.add(abort);

    pack();
    setLocationRelativeTo(getOwner());
  }
예제 #23
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
  }
예제 #24
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();
  }
예제 #25
0
파일: Button2.java 프로젝트: ktw14/vitoex
 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);
 }
예제 #26
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);
  }
예제 #27
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);
 }
예제 #28
0
파일: JSheet.java 프로젝트: karlvr/Quaqua
  /**
   * 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();
  }
예제 #29
0
 public AllProperties() {
   super("Properties", true, false, true, true);
   Container contentPane = getContentPane();
   contentPane.setLayout(new GridLayout(2, 1, 10, 10));
   contentPane.add(new PropertyPanel("System Properties", System.getProperties()));
   contentPane.add(new PropertyPanel("Aleph Properties", Aleph.getProperties()));
   setPreferredSize(preferred);
   setBounds(0, 0, preferred.width, preferred.height);
 }
예제 #30
0
  /**
   * Luodaan ja asetetaan käyttöliittymän komponentit käyttöliittymään.
   *
   * @param container
   */
  public void luoKomponentit(Container container) {
    GridLayout layout = new GridLayout(4, 1);
    container.setLayout(layout);

    luoInfolaatikko(container);
    luoKysymysKentta(container);
    JTextField tekstiKentta = luoTekstiKentta(container);
    luoTarkistaJaGeneroiNappula(container, tekstiKentta);
  }