Ejemplo n.º 1
0
  // panneau du haut
  public void initPanneauHautComponents() {
    int y_Pos = labels[1].getY() - 5;

    comboCollection = new JComboBox();
    comboCollection.setBounds(
        labels[0].getX() + labels[0].getWidth(),
        labels[0].getY(),
        haut.getWidth() - (labels[0].getX() + labels[0].getWidth()),
        20);

    mode[0] = new JRadioButton(radio_text[0]);
    mode[0].setBounds(labels[1].getX() + labels[1].getWidth(), y_Pos, 100, 30);
    mode[0].setSelected(true);

    mode[1] = new JRadioButton(radio_text[1]);
    mode[1].setBounds(mode[0].getX() + mode[0].getWidth() + 5, y_Pos, 60, 30);

    mode[2] = new JRadioButton(radio_text[2]);
    mode[2].setBounds(mode[1].getX() + mode[1].getWidth() + 5, y_Pos, 100, 30);

    mode[3] = new JRadioButton(radio_text[3]);
    mode[3].setBounds(mode[2].getX() + mode[2].getWidth() + 5, y_Pos, 100, 30);

    haut.add(comboCollection);

    for (int j = 0; j < mode.length; j++) {
      haut.add(mode[j]);
    }
  }
  /**
   * This method initializes mIndividualListComboBox
   *
   * @return javax.swing.JComboBox
   */
  private JComboBox getMIndividualListComboBox() {
    if (mIndividualListComboBox == null) {
      mIndividualListComboBox = new JComboBox();
      mIndividualListComboBox.setBounds(new java.awt.Rectangle(228, 103, 168, 25));
      mIndividualListComboBox.setEditable(false);
    }

    return mIndividualListComboBox;
  }
 private JComboBox getCeleBodyBox() {
   if (celeBodyBox == null) {
     ComboBoxModel celeBodyBoxModel = new DefaultComboBoxModel(CelestrialBody.values());
     celeBodyBox = new JComboBox();
     celeBodyBox.setModel(celeBodyBoxModel);
     celeBodyBox.setBounds(325, 95, 133, 21);
     celeBodyBox.setAction(getCeleBodyAction());
   }
   return celeBodyBox;
 }
 public ejemplo6_javaya() {
   setLayout(null);
   combo1 = new JComboBox();
   combo1.setBounds(10, 10, 80, 20);
   add(combo1);
   combo1.addItem("rojo");
   combo1.addItem("vede");
   combo1.addItem("azul");
   combo1.addItem("amarillo");
   combo1.addItem("negro");
   combo1.addItemListener(this);
 }
Ejemplo n.º 5
0
  private void resizeCantor(int width, int height) {
    int cantorEWidth = (width - 200) / 3;
    int cantorJtaHeight = 18;
    int cantorYList = 300;

    int cantorBWidth = 100;
    int cantorBHeight = 25;
    cantorPay.setBounds(10, 10, 150, cantorJtaHeight);
    cantorCurrL1.setBounds(10, 10, 150, 18);
    cantorScrollPane.setBounds(
        cantorCurrL1.getX() + cantorCurrL1.getWidth() + 40, cantorYList - 270, 500, 230);
    cantorBuyLabel.setBounds(
        cantorScrollPane.getX(), cantorScrollPane.getY() - 20, cantorEWidth, 18);
    cantorCurrBox1.setBounds(10, cantorCurrL1.getY() + 20, 100, 20);
    cantorCurrL2.setBounds(10, cantorCurrBox1.getY() + 20, cantorEWidth, 18);
    cantorCurrBox2.setBounds(cantorCurrBox1.getX(), cantorCurrL2.getY() + 20, 100, 20);
    cantorPrice.setBounds(cantorCurrBox2.getX(), cantorCurrBox2.getY() + 30, 150, cantorJtaHeight);
    cantorAmountJta.setBounds(cantorPrice.getX(), cantorPrice.getY() + 20, 100, cantorJtaHeight);
    cantorResButton.setBounds(
        cantorAmountJta.getX(), cantorAmountJta.getY() + 22, cantorBWidth, cantorBHeight);
    cantorCostLabel.setBounds(
        cantorResButton.getX(), cantorResButton.getY() + 28, 150, cantorJtaHeight);
    cantorCostJta.setBounds(
        cantorCostLabel.getX(), cantorCostLabel.getY() + 22, 100, cantorJtaHeight);
    cantorClientL.setBounds(10, cantorCostJta.getY() + 80, cantorEWidth, 18);
    cantorPESJta.setBounds(cantorClientL.getX(), cantorClientL.getY() + 22, 100, cantorJtaHeight);
    cantorPESButton.setBounds(
        cantorPESJta.getX(), cantorPESJta.getY() + 22, cantorBWidth, cantorBHeight);
    cantorScrollClientPane.setBounds(
        cantorScrollPane.getX(),
        cantorScrollPane.getY() + cantorScrollPane.getHeight() + 30,
        550,
        230);
    cantorDoIt.setBounds(
        cantorCostJta.getX(), cantorCostJta.getY() + 300, cantorBWidth + 50, cantorBHeight);
  }
Ejemplo n.º 6
0
  /*Aqui viene lo interesante*/
  public void
      Interfaz_Trabajador() // metodo que lo que hace es poner los botones y demas cosas de la GUI
                            // para ingresar Trabajadores
      {
    this.setLayout(
        null); // me permite poner donde yo quiera los botones ya que el layout no es el por defecto

    trab = new JLabel("Nombre del Trabajador");
    boton1 = new JButton("Ingresar trabajador");
    user = new JTextField(null); // campo donde se ingresa el nombre del trabajador
    id1 = new JTextField(); // campo para ingresar el id
    list = new JComboBox /*<String>*/(); // lista de trabajadores ingresados que se pueden usar
    ID = new JLabel("Numero de Identificaci�n");
    ventas = new JButton("Ingresar");
    informe = new JButton("Informe de ventas");

    trab.setBounds(
        5, 10, 130,
        9); /*localizacion del objeto. X,Y,H,W. X es la posicion en X, Y es lo mismo pero en Y.
            H y W son la altura y ancho del boton respectivamante*/
    this.add(trab); // es agregado a la ventana

    user.setBounds(138, 5, 130, 20);
    this.add(user);

    ID.setBounds(5, 40, 145, 9);
    this.add(ID);

    id1.setBounds(165, 35, 80, 20);
    this.add(id1);

    boton1.setBounds(55, 60, 150, 20);
    boton1.addActionListener(
        this); // el boton recibe la propiedad de actionListener, se le pone el daemon y si es
               // cliceado, se mandara al metodo
    this.add(boton1);

    list.setBounds(55, 100, 150, 50);
    this.add(list);

    ventas.setBounds(55, 170, 150, 20);
    ventas.addActionListener(this);
    this.add(ventas);

    informe.setBounds(55, 200, 150, 20);
    informe.addActionListener(this); // si es cliceado, se mandara al metodo
    this.add(informe);
  }
Ejemplo n.º 7
0
  /** Creates new form gui */
  public gui() {
    super(new BorderLayout());
    initComponents();

    // Load user list and images
    images = new ImageIcon[userStrings.length];
    Integer[] intArray = new Integer[userStrings.length];
    for (int i = 0; i < userStrings.length; i++) {
      intArray[i] = new Integer(i);
      images[i] = createImageIcon("images/" + userStrings[i] + ".png");
      if (images[i] != null) {
        images[i].setDescription(userStrings[i]);
      }
    }
    users = new JComboBox(intArray);
    Color bg = (Color) UIManager.get("ComboBox.background");
    Color fg = (Color) UIManager.get("ComboBox.foreground");
    UIManager.put("ComboBox.selectionBackground", bg);
    UIManager.put("ComboBox.selectionForeground", fg);
    users.setUI(new MetalComboBoxUI());
    // ComboBoxRenderer renderer = new ComboBoxRenderer();
    ComboBoxRenderer renderer = new ComboBoxRenderer(userStrings, images);
    renderer.setPreferredSize(new Dimension(650, 150));
    users.setRenderer(renderer);
    users.setSize(renderer.getPreferredSize());
    users.setMaximumRowCount(4);
    users.setBounds(150, 250, 650, 200);
    add(users);
    // setBorder(BorderFactory.createEmptyBorder(20,20,20,20));

    // Set the user satisfaction labels
    jSlider1.setPaintTicks(true);
    Hashtable labelTable = new Hashtable();
    for (int i = 0; i < labels.length; i++) {
      labelTable.put(new Integer(i), new JLabel(labels[i]));
    }

    jSlider1.setLabelTable(labelTable);

    jSlider1.setPaintLabels(true);

    socket = new generalSocket(machine, 1099);

    statusThread thread = new statusThread(socket, jLabel4);
    Thread theThread = new Thread(thread);
    theThread.start();
  }
  /**
   * Constructeur de la classe
   *
   * @param numJoueur rang du joueur dans la liste des joueurs
   */
  public CadranSaisieInfoOrdinateur(int numJoueur) {

    this.setOpaque(false);
    this.setLayout(null);

    imageCadran.setIcon(
        new ImageIcon(getClass().getResource("/CadranJoueur" + numJoueur + ".png")));
    this.add(imageCadran);
    imageCadran.setBounds(0, 0, 160, 150);

    strategie.setOpaque(false);
    strategie.setFont(new java.awt.Font("Wawati SC", 0, 13));
    strategie.setBounds(3, 112, 150, 33);
    this.add(strategie, 0);

    strategie.setModel(
        new javax.swing.DefaultComboBoxModel(
            new String[] {"Agressif", "Agressif avec Bluff", "Normal", "Passif"}));
  }
Ejemplo n.º 9
0
  newframe() {
    super("USER 1");
    setSize(870, 760);
    setLocation(500, 200);
    panel.setLayout(null);

    rent.setBounds(350, 120, 140, 20);
    his.setBounds(350, 180, 140, 20);
    avai.setBounds(350, 150, 140, 20);
    welcome.setBounds(365, 50, 150, 60);
    cat.setBounds(350, 210, 140, 20);

    panel.add(welcome);
    panel.add(rent);
    panel.add(his);
    panel.add(avai);
    panel.add(cat);

    getContentPane().add(panel);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setVisible(true);
  }
Ejemplo n.º 10
0
  public void SpelersCombo(int ronde) {
    String[] spelers = null;
    if (ronde == 0) {
      spelers = new String[1];
      spelers[0] = "Geen Spelers";
    } else {
      spelers = oc.GeefSpelers(ronde);
    }

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

          public void itemStateChanged(ItemEvent evt) {
            cbSpelerItemStateChanged(evt);
          }
        });
  } // public void SpelersCombo(int ronde)
Ejemplo n.º 11
0
  private void initStart() {
    // setResizable(false);
    setLayout(null);

    jlb = new JLabel("참여 인원수를 선택하세요");
    jlb.setBounds(7, 7, 160, 20);

    jcb = new JComboBox();
    for (int i = 2; i <= 10; i++) jcb.addItem(i);
    jcb.setSelectedItem(6);
    jcb.setMaximumRowCount(9);
    jcb.setBounds(50, 34, 70, 20);

    start_bt = new JButton("Start");
    start_bt.setBounds(45, 62, 80, 30);
    con.add(jlb);
    con.add(start_bt);
    con.add(jcb);

    start_bt.addActionListener(this);
    jcb.addActionListener(this);

    setVisible(true);
  }
Ejemplo n.º 12
0
  public Viajes() {
    super.setBounds(181, 61, 700, 538); // (ancho,alto)
    super.setLayout(null);
    super.setOpaque(false);
    super.setVisible(false);

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    tbDatos = new JTable(dataModel);
    tbDatos.setEnabled(false);
    tbDatos.setAutoResizeMode(5);
    tbDatos.setCellSelectionEnabled(true);
    tbDatos.setForeground(Color.BLACK);
    pnDatos = new JScrollPane(tbDatos);
    pnDatos.setBounds(30, 30, 640, 478);
    pnDatos.setVisible(false);
    this.add(pnDatos);
    llenarDatos();

    jlbCodigo = new JLabel("*Código");
    jlbCodigo.setBounds(90, 100, 220, 25);
    jlbCodigo.setForeground(Color.BLACK);
    jlbCodigo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbCodigo);

    jtxtCodigo = new JTextField("");
    jtxtCodigo.setBounds(90, 125, 520, 30);
    jtxtCodigo.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    jtxtCodigo.addKeyListener(this);
    this.add(jtxtCodigo);

    jlbOrigen = new JLabel("*Origen");
    jlbOrigen.setBounds(90, 180, 150, 25);
    jlbOrigen.setForeground(Color.BLACK);
    jlbOrigen.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbOrigen);

    jcbOrigen = new JComboBox();
    jcbOrigen.setBorder(null);
    jcbOrigen.setBackground(Color.WHITE);
    jcbOrigen.addItem("Medellín");
    jcbOrigen.addItem("Bogotá");
    jcbOrigen.addItem("Barranquilla");
    jcbOrigen.setBounds(90, 205, 250, 30);
    this.add(jcbOrigen);

    jlbDestino = new JLabel("*Destino");
    jlbDestino.setBounds(360, 180, 150, 25);
    jlbDestino.setForeground(Color.BLACK);
    jlbDestino.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbDestino);

    jcbDestino = new JComboBox();
    jcbDestino.setBorder(null);
    jcbDestino.setBackground(Color.WHITE);
    jcbDestino.addItem("Bogotá");
    jcbDestino.addItem("Medellín");
    jcbDestino.addItem("Barranquilla");
    jcbDestino.setBounds(360, 205, 250, 30);
    this.add(jcbDestino);

    jlbPrecio = new JLabel("*Precio");
    jlbPrecio.setBounds(90, 260, 120, 25);
    jlbPrecio.setForeground(Color.BLACK);
    jlbPrecio.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbPrecio);

    jtxtPrecio = new JTextField("");
    jtxtPrecio.setBounds(90, 285, 520, 30);
    jtxtPrecio.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    jtxtPrecio.addKeyListener(this);
    this.add(jtxtPrecio);

    jlbEstado = new JLabel("*Estado");
    jlbEstado.setBounds(90, 340, 150, 25);
    jlbEstado.setForeground(Color.BLACK);
    jlbEstado.setFont(new Font("Segoe UI", Font.PLAIN, 18));
    this.add(jlbEstado);

    jcbEstado = new JComboBox();
    jcbEstado.setBorder(null);
    jcbEstado.setBackground(Color.WHITE);
    jcbEstado.addItem("Activo");
    jcbEstado.addItem("Inactivo");
    jcbEstado.setBounds(90, 365, 520, 30);
    this.add(jcbEstado);

    jbtnListar = new JButton(" Lista");
    jbtnListar.setBounds(0, 0, 233, 60);
    jbtnListar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/icons/List-26.png")));
    jbtnListar.setBorder(null);
    jbtnListar.setBackground(new Color(0, 154, 225));
    jbtnListar.setForeground(Color.WHITE);
    jbtnListar.setFont(new Font("Segoe UI", Font.PLAIN, 20));
    jbtnListar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnListar.addMouseListener(this);
    jbtnListar.addActionListener(this);
    jbtnListar.setFocusPainted(false);
    this.add(jbtnListar);

    jbtnBuscar = new JButton(" Buscar");
    jbtnBuscar.setBounds(233, 0, 234, 60);
    jbtnBuscar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/icons/Search-26.png")));
    jbtnBuscar.setBorder(null);
    jbtnBuscar.setBackground(new Color(0, 154, 225));
    jbtnBuscar.setForeground(Color.WHITE);
    jbtnBuscar.setFont(new Font("Segoe UI", Font.PLAIN, 20));
    jbtnBuscar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnBuscar.addMouseListener(this);
    jbtnBuscar.addActionListener(this);
    jbtnBuscar.setFocusPainted(false);
    this.add(jbtnBuscar);

    jbtnActualizar = new JButton(" Actualizar");
    jbtnActualizar.setBounds(233, 0, 234, 60);
    jbtnActualizar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/icons/Edit-26.png")));
    jbtnActualizar.setBorder(null);
    jbtnActualizar.setBackground(new Color(0, 154, 225));
    jbtnActualizar.setForeground(Color.WHITE);
    jbtnActualizar.setFont(new Font("Segoe UI", Font.PLAIN, 20));
    jbtnActualizar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnActualizar.addMouseListener(this);
    jbtnActualizar.setVisible(false);
    jbtnActualizar.addActionListener(this);
    jbtnActualizar.setFocusPainted(false);
    this.add(jbtnActualizar);

    jbtnLimpiar = new JButton(" Limpiar");
    jbtnLimpiar.setBounds(467, 0, 233, 60);
    jbtnLimpiar.setIcon(new ImageIcon(getClass().getResource("/Imagenes/icons/Clean-26.png")));
    jbtnLimpiar.setBorder(null);
    jbtnLimpiar.setBackground(new Color(0, 154, 225));
    jbtnLimpiar.setForeground(Color.WHITE);
    jbtnLimpiar.setFont(new Font("Segoe UI", Font.PLAIN, 20));
    jbtnLimpiar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnLimpiar.addMouseListener(this);
    jbtnLimpiar.addActionListener(this);
    jbtnLimpiar.setFocusPainted(false);
    this.add(jbtnLimpiar);

    jpBotones = new JPanel();
    jpBotones.setBackground(new Color(0, 123, 183));
    jpBotones.add(jbtnListar);
    jpBotones.add(jbtnBuscar);
    jpBotones.add(jbtnActualizar);
    jpBotones.add(jbtnLimpiar);
    jpBotones.setLayout(null);
    jpBotones.setBounds(0, 478, 700, 60);
    this.add(jpBotones);

    jlbValidar = new JLabel("Los campos con (*) son obligatorios");
    jlbValidar.setForeground(Color.WHITE);
    jlbValidar.setBounds(80, 8, 300, 27);
    jlbValidar.setFont(new Font("Segoe UI", Font.PLAIN, 17));
    this.add(jlbValidar);

    jpError = new JPanel();
    jpError.add(jlbValidar);
    jpError.setLayout(null);
    jpError.setBackground(new Color(0, 123, 183));
    jpError.setBounds(0, 0, 700, 45);
    this.add(jpError);

    this.repaint();
  }
Ejemplo n.º 13
0
  public static void main(String args[]) {
    // style that is necessary
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
    } catch (InstantiationException e) {
    } catch (IllegalAccessException e) {
    } catch (UnsupportedLookAndFeelException e) {
    }

    // Standard preparation for a frame
    fmain = new JFrame("Schedule Appointments"); // Create and name frame
    fmain.setSize(330, 375); // Set size to 400x400 pixels
    pane = fmain.getContentPane();
    pane.setLayout(null); // Apply null layout
    fmain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Close when X is clicked

    // controls and portions of Calendar
    lmonth = new JLabel("January");
    lyear = new JLabel("Change year:");
    cyear = new JComboBox();
    prev = new JButton("<<");
    next = new JButton(">>");
    canc = new JButton("Cancel");
    mcal =
        new DefaultTableModel() {
          public boolean isCellEditable(int rowIndex, int mColIndex) {
            return false;
          }
        };
    Cal = new JTable(mcal);
    scal = new JScrollPane(Cal);
    pcal = new JPanel(null);

    canc.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });

    // action listeners for buttons and the like
    prev.addActionListener(new btnPrev_Action());
    next.addActionListener(new btnNext_Action());
    cyear.addActionListener(new cmbYear_Action());
    Cal.addMouseListener(new mouseCont());

    // Adding the elements to the pane
    pane.add(pcal);
    pcal.add(lmonth);
    pcal.add(cyear);
    pcal.add(prev);
    pcal.add(next);
    pcal.add(canc);
    pcal.add(scal);

    // Setting where the elements are on the pane
    pcal.setBounds(0, 0, 320, 335);
    lmonth.setBounds(160 - lmonth.getPreferredSize().width / 2, 25, 100, 25);
    canc.setBounds(10, 305, 80, 20);
    cyear.setBounds(215, 305, 100, 20);
    prev.setBounds(10, 25, 50, 25);
    next.setBounds(260, 25, 50, 25);
    scal.setBounds(10, 50, 300, 250);

    // Make frame visible
    fmain.setResizable(false);
    fmain.setVisible(true);

    // Inner workings for the day mechanism
    GregorianCalendar cal = new GregorianCalendar(); // Create calendar
    rday = cal.get(GregorianCalendar.DAY_OF_MONTH); // Get day
    rmonth = cal.get(GregorianCalendar.MONTH); // Get month
    ryear = cal.get(GregorianCalendar.YEAR); // Get year
    currentMonth = rmonth; // Match month and year
    currentYear = ryear;

    // Add days
    String[] days = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; // All of the days
    for (int i = 0; i < 7; i++) {
      mcal.addColumn(days[i]);
    }

    Cal.getParent().setBackground(Cal.getBackground()); // Set background

    // No resize/reorder
    Cal.getTableHeader().setResizingAllowed(false);
    Cal.getTableHeader().setReorderingAllowed(false);

    // Single cell selection
    Cal.setColumnSelectionAllowed(true);
    Cal.setRowSelectionAllowed(true);
    Cal.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // Set row/column count
    Cal.setRowHeight(38);
    mcal.setColumnCount(7);
    mcal.setRowCount(6);

    // Placing the dates in the cells
    for (int i = ryear - 100; i <= ryear + 100; i++) {
      cyear.addItem(String.valueOf(i));
    }

    // Refresh calendar
    refreshCalendar(rmonth, ryear); // Refresh calendar
  }
Ejemplo n.º 14
0
  // again, sets the gui
  void init(final int perspective, final Puzzle puzzle) {
    con.removeAll();
    setBounds(0, 0, 1400, 1030);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel header = new JLabel("Edit Puzzle");
    header.setFont(new Font("Serif", Font.BOLD, 40));
    header.setForeground(Color.BLACK);
    header.setBounds(600, 0, 290, 50);
    canvas = new MyCanvas(perspective);
    canvas.setBounds(30, 120, 800, 800);
    canvas.boxItem = puzzle.boxItems;
    canvas.isfromEditBoard = true;
    panel.setBackground(Color.orange);
    panel.setBounds(0, 0, 1300, 1000);
    JLabel[] alphabets = asigningalphabets(perspective);
    JLabel[] alphabets1 = asigningalphabets1(perspective);
    JLabel[] numbers = assigningnumbers(perspective);
    JLabel[] numbers1 = assigningnumbers1(perspective);
    JButton buttonNext = new JButton("Edit");
    buttonNext.setBounds(1150, 850, 120, 30);
    buttonNext.setFont(new Font("Serif", Font.BOLD, 20));
    buttonNext.setFocusable(false);
    JButton backButton = new JButton("Return");
    backButton.setBounds(930, 850, 120, 30);
    backButton.setFont(new Font("Serif", Font.BOLD, 20));
    backButton.setFocusable(false);
    listmodel = new DefaultListModel();
    enterPuzzle(puzzle.getcategoryName());
    final JList listofMoves = new JList(listmodel);
    JScrollPane list = new JScrollPane();
    list.setViewportView(listofMoves);
    list.setBounds(870, 350, 500, 300);
    listofMoves.setFont(new Font("Serif", Font.PLAIN, 20));
    for (int i = 0; i < listmodel.getSize(); i++) {
      CategoryNode tmp = ChessApplication.l.head;
      while (tmp != null) {
        if (tmp.categoryName.equalsIgnoreCase(puzzle.getcategoryName())) {
          Puzzle temp = tmp.h;
          int counter = 0;
          while (temp != null) {
            if (temp.getFenString().equalsIgnoreCase(puzzle.getFenString())) {
              listofMoves.setSelectedIndex(counter);
            }
            temp = temp.next;
            counter++;
          }
        }
        tmp = tmp.next;
      }
    }
    JLabel categoryLabel = new JLabel("Select Category");
    categoryLabel.setFont(new Font("Serif", Font.BOLD, 20));
    categoryLabel.setBounds(1020, 160, 290, 30);
    JLabel movesLabel = new JLabel("Select Puzzle");
    movesLabel.setFont(new Font("Serif", Font.BOLD, 20));
    movesLabel.setBounds(1030, 310, 290, 30);
    DefaultComboBoxModel catagorylist = new DefaultComboBoxModel();
    for (int i = 1; i < BoardtoAdd.listofCategory.getSize(); i++) {
      catagorylist.addElement(BoardtoAdd.listofCategory.getElementAt(i));
    }
    final JComboBox categoryBox = new JComboBox(catagorylist);
    categoryBox.setBounds(1000, 200, 200, 30);
    categoryBox.setFont(new Font("Serif", Font.BOLD, 20));
    categoryBox.setSelectedItem(puzzle.getcategoryName());
    backButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            setRunningFalse();
            ChessApplication.editboard.setVisible(false);
            ChessApplication.startform.setVisible(true);
          }
        });
    buttonNext.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            setRunningFalse();
            ChessApplication.editboard.setVisible(false);
            ChessApplication.boardtoedit.init("Edit Moves", perspective, false, puzzle);
          }
        });
    listofMoves.addMouseListener(
        new MouseListener() {

          @Override
          public void mouseClicked(MouseEvent e) {
            setRunningFalse();
            ChessApplication.editboard.setVisible(false);
            puzzle.setBoxItems();
            ChessApplication.editboard.init(
                getPuzzle(categoryBox.getSelectedItem().toString(), listofMoves.getSelectedIndex())
                    .position
                    .getToPlay(),
                getPuzzle(
                    categoryBox.getSelectedItem().toString(), listofMoves.getSelectedIndex()));
          }

          @Override
          public void mousePressed(MouseEvent e) {}

          @Override
          public void mouseReleased(MouseEvent e) {}

          @Override
          public void mouseEntered(MouseEvent e) {}

          @Override
          public void mouseExited(MouseEvent e) {}
        });
    categoryBox.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            setRunningFalse();
            ChessApplication.editboard.setVisible(false);
            puzzle.setBoxItems();
            ChessApplication.editboard.init(
                getPuzzle(categoryBox.getSelectedItem().toString()).position.getToPlay(),
                getPuzzle(categoryBox.getSelectedItem().toString()));
          }
        });
    for (int i = 0; i < 8; i++) {
      con.add(alphabets[i]);
      con.add(numbers[i]);
      con.add(alphabets1[i]);
      con.add(numbers1[i]);
    }
    con.add(categoryLabel);
    con.add(movesLabel);
    con.add(categoryBox);
    con.add(list);
    con.add(backButton);
    con.add(buttonNext);
    con.add(header);
    con.add(canvas);
    con.setBackground(Color.orange);
    con.add(panel);
    setVisible(true);
    canvas.start();
  }
Ejemplo n.º 15
0
  /** Initialize the contents of the frame. */
  @SuppressWarnings({"unchecked", "rawtypes"})
  private void initialize() {
    setOpaque(false);
    setLayout(null);

    JPanel panel_1 = new JPanel();
    panel_1.setBounds(529, 32, 246, 65);
    panel_1.setOpaque(false);
    panel_1.setBorder(
        new TitledBorder(null, "得到用户", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panel_1);
    panel_1.setLayout(null);

    JLabel lblId = new JLabel("用户ID");
    lblId.setBounds(6, 28, 66, 15);
    panel_1.add(lblId);

    txtid = new JTextField();
    txtid.setBounds(72, 24, 89, 21);
    txtid.setText("");
    panel_1.add(txtid);
    txtid.setColumns(10);

    JButton button_1 = new JButton("");
    button_1.setBounds(173, 12, 50, 50);
    button_1.setIcon(new ImageIcon(UserManage.class.getResource("/image/ok.png")));
    button_1.setBorderPainted(false);
    button_1.setContentAreaFilled(false);
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String id = txtid.getText();
            if (id.equals("") || id == null) Methods.showTip("请输入用户账号");
            else {
              AdminBLService ad = new AdminController();
              UserVo v = ad.getUserById(id);

              if (v == null) {
                Methods.showTip("该用户不存在");
              } else {
                tableUser.setRowCount(0);
                tableUser.addRow(
                    new Object[] {
                      v.getID(),
                      Methods.eToC(v.getRole()),
                      v.getPassword(),
                      v.getName(),
                      v.getGender(),
                      v.getBirthday(),
                      v.getIc(),
                      v.getDepartment(),
                      v.getRegisterYear(),
                      v.getContact()
                    });
              }
            }

            txtid.setText("");
          }
        });
    panel_1.add(button_1);

    JPanel panel_2 = new JPanel();
    panel_2.setBounds(529, 249, 246, 283);
    panel_2.setOpaque(false);
    panel_2.setBorder(
        new TitledBorder(null, "用户信息", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panel_2);
    panel_2.setLayout(null);

    JLabel lblid = new JLabel("用户ID");
    lblid.setBounds(11, 29, 53, 16);
    panel_2.add(lblid);

    txtid_1 = new JTextField();
    txtid_1.setEditable(false);
    txtid_1.setBounds(63, 27, 134, 22);
    panel_2.add(txtid_1);
    txtid_1.setColumns(10);

    JLabel label_1 = new JLabel("身份");
    label_1.setBounds(11, 65, 38, 16);
    panel_2.add(label_1);

    comboBox_2 = new JComboBox();
    comboBox_2.setBounds(63, 60, 134, 27);
    comboBox_2.setModel(
        new DefaultComboBoxModel(new String[] {"【请选择】", "教务处老师", "院系教务老师", "任课老师", "学生"}));
    comboBox_2.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            String role = (String) comboBox_2.getSelectedItem();

            // 根据用户角色初始化需填的信息
            if (role.equals("教务处老师")) {
              textField_1.setEditable(false);
            }
            if (role.equals("院系教务老师") || role.equals("任课老师")) {
              textField_1.setEditable(true);
            }
            if (role.equals("学生")) {
              textField_1.setEditable(true);
            }
          }
        });
    panel_2.add(comboBox_2);

    JLabel label_2 = new JLabel("姓名");
    label_2.setBounds(11, 100, 38, 16);
    panel_2.add(label_2);

    txtnamestring = new JTextField();
    txtnamestring.setEditable(false);
    txtnamestring.setBounds(63, 97, 134, 23);
    panel_2.add(txtnamestring);
    txtnamestring.setColumns(10);

    JLabel label_3 = new JLabel("密码");
    label_3.setBounds(11, 133, 34, 16);
    panel_2.add(label_3);

    textField = new JTextField();
    textField.setEditable(false);
    textField.setBounds(64, 130, 134, 23);
    panel_2.add(textField);
    textField.setColumns(10);

    JLabel lblNewLabel = new JLabel("院系");
    lblNewLabel.setBounds(11, 166, 34, 15);
    panel_2.add(lblNewLabel);

    textField_1 = new JTextField();
    textField_1.setEditable(false);
    textField_1.setBounds(64, 163, 134, 21);
    panel_2.add(textField_1);
    textField_1.setColumns(10);

    final JButton btns = new JButton("");
    btns.setIcon(new ImageIcon(UserManage.class.getResource("/image/publish.png")));
    btns.setToolTipText("点击提交");
    btns.setBorderPainted(false);
    btns.setBounds(99, 205, 50, 50);
    btns.setEnabled(false);
    btns.setContentAreaFilled(false);
    btns.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String id = txtid_1.getText();

            if (((String) comboBox_2.getSelectedItem()).equals("【请选择】")) {
              Methods.showTip("请选择用户身份");
              return;
            }
            String role = Methods.cToE((String) comboBox_2.getSelectedItem());
            String name = txtnamestring.getText();
            String pass = textField.getText();
            String de = textField_1.getText();

            if (id.length() == 0 || pass.length() == 0) {
              Methods.showTip("请输入完整信息");
              return;
            }

            String result;
            AdminBLService ad = new AdminController();
            switch (type) {
              case 0:
                modiUser.setRole(role);
                modiUser.setDepartment(de);
                result = ad.modifyUser(modiUser);
                break;
              case 1:
                /*
                 * 根据用户的身份判断管理员信息是否添加完整
                 */
                if ((!role.equals("JW")) && de.length() == 0) {
                  Methods.showTip("请输入完整信息");
                  return;
                }
                UserVo adUser = new UserVo(id, role, pass, name, "", "", "", de, 0, "");
                result = ad.addUser(adUser);
                break;
              default:
                result = "";
            }
            btns.setEnabled(false);
            if (result.equals("") || result == null) ;
            else {
              Methods.showTip(result);
            }

            // 清空提交过的用户信息并恢复文本框为不可编辑
            txtid_1.setText("");
            txtid_1.setEditable(false);
            comboBox_2.setSelectedIndex(0);
            txtnamestring.setText("");
            txtnamestring.setEditable(false);
            textField.setText("");
            textField.setEditable(false);
            textField_1.setEditable(false);
            textField_1.setText("");
          }
        });
    panel_2.add(btns);

    JPanel panel_3 = new JPanel();
    panel_3.setBounds(529, 127, 246, 96);
    panel_3.setOpaque(false);
    panel_3.setBorder(
        new TitledBorder(null, "操作", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panel_3);
    panel_3.setLayout(null);

    JButton btna = new JButton("");
    btna.setBounds(19, 23, 66, 62);
    panel_3.add(btna);
    btna.setToolTipText("点击添加用户");
    btna.setIcon(new ImageIcon(UserManage.class.getResource("/image/add.png")));
    btna.setBorderPainted(false);

    JButton btnm = new JButton("");
    btnm.setBounds(90, 23, 66, 62);
    panel_3.add(btnm);
    btnm.setIcon(new ImageIcon(UserManage.class.getResource("/image/fill.png")));
    btnm.setToolTipText("点击修改用户");
    btnm.setBorderPainted(false);
    btnm.setContentAreaFilled(false);
    btnm.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int row = table.getSelectedRow();

            /*
             * 得到用户原始的各项信息,存于modiUser对象中
             */
            String id = (String) table.getValueAt(row, 0);
            String role = (String) table.getValueAt(row, 1);
            String password = (String) table.getValueAt(row, 2);
            String name = (String) table.getValueAt(row, 3);
            String gender = (String) table.getValueAt(row, 4);
            String birth = (String) table.getValueAt(row, 5);
            String ic = (String) table.getValueAt(row, 6);
            String de = (String) table.getValueAt(row, 7);
            int grade = (Integer) table.getValueAt(row, 8);

            txtid_1.setText(id);
            comboBox_2.setSelectedItem(role);
            txtnamestring.setText(name);
            textField.setText(password);
            textField_1.setText(de);
            modiUser = new UserVo(id, role, password, name, gender, birth, ic, de, grade, "");

            type = 0;
            btns.setEnabled(true);

            /*
             * 用户的ID、姓名、密码、年级(即注册年份)不允许更改
             */
            txtid_1.setEditable(false);
            textField.setEditable(false);
            txtnamestring.setEditable(false);

            textField_1.setEditable(true);
          }
        });

    JButton btnd = new JButton("");
    btnd.setBounds(161, 23, 66, 62);

    btnd.setBorderPainted(false);
    btnd.setIcon(new ImageIcon(UserManage.class.getResource("/image/delete.png")));
    btnd.setToolTipText("点击删除用户");
    btnd.setContentAreaFilled(false);
    btnd.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int row = table.getSelectedRow();

            /*
             * 根据要删除的用户角色执行不同的操作
             */
            String role = Methods.cToE((String) table.getValueAt(row, 1));
            if (role.equals("Student") || role.equals("Teacher")) {
              deleteStudent(row);
            }
            /*if (role.equals("Teacher")) {
            	deleteTeacher(row);
            }*/
            if (role.equals("YXJW") || role.equals("JW")) {
              deleteJW(row, role);
            }
          }
        });
    panel_3.add(btnd);

    btna.setContentAreaFilled(false);
    btna.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            type = 1;

            // 清空原有信息
            txtid_1.setText("");
            comboBox_2.setSelectedIndex(0);
            txtnamestring.setText("");
            textField.setText("");
            textField_1.setText("");

            btns.setEnabled(true);
            txtid_1.setEditable(true);
            textField.setEditable(true);
            txtnamestring.setEditable(true);
            textField_1.setEditable(true);
          }
        });
    btna.setContentAreaFilled(false);

    JPanel panel_5 = new JPanel();
    panel_5.setBounds(6, 32, 515, 500);
    panel_5.setOpaque(false);
    panel_5.setBorder(
        new TitledBorder(null, "用户列表", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panel_5);
    panel_5.setLayout(null);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 70, 489, 424);
    panel_5.add(scrollPane);

    table = new JTable();
    table.setModel(tableUser);
    table.getColumnModel().getColumn(1).setPreferredWidth(90);
    table.getColumnModel().getColumn(6).setPreferredWidth(120);
    table.getColumnModel().getColumn(7).setPreferredWidth(100);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    scrollPane.setViewportView(table);

    comboBox = new JComboBox();
    comboBox.setBounds(10, 30, 153, 27);
    panel_5.add(comboBox);
    comboBox.setModel(
        new DefaultComboBoxModel(new String[] {"身份【全部】", "教务处老师", "院系教务老师", "任课老师", "学生"}));

    comboBox_1 = new JComboBox();
    comboBox_1.setBounds(192, 30, 147, 27);
    panel_5.add(comboBox_1);

    /*
     * 初始化院系选项
     */
    AdminBLService ad = new AdminController();
    ArrayList<String> de = ad.getDepartment();
    String[] department = new String[de.size() + 1];
    department[0] = "院系【全部】";
    for (int i = 0; i < de.size(); i++) {
      department[i + 1] = de.get(i);
    }

    comboBox_1.setModel(new DefaultComboBoxModel(department));

    ImageIcon i = new ImageIcon(UserManage.class.getResource("/image/ok.png"));
    JButton button1 = new JButton(i);
    button1.setBounds(376, 12, 50, 50);
    button1.setToolTipText("点击获取筛选结果");
    button1.setOpaque(false);
    button1.setBorderPainted(false);
    button1.setContentAreaFilled(false);
    panel_5.add(button1);
    button1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            int rowcount = tableUser.getRowCount();
            while (rowcount != 0) {
              tableUser.removeRow(--rowcount);
            }
            String identity = (String) comboBox.getSelectedItem();
            String department = (String) comboBox_1.getSelectedItem();
            AdminBLService ad = new AdminController();
            ArrayList<UserVo> list;
            if (identity.equals("身份【全部】") && department.equals("院系【全部】")) {
              list = ad.getUser();
            } else if (identity.equals("身份【全部】")) list = ad.getDeUser(department);
            else if (department.equals("院系【全部】")) list = ad.getUser(Methods.cToE(identity));
            else list = ad.getDeUser(department, Methods.cToE(identity));

            if (list != null && list.size() != 0) {
              for (int i = 0; i < list.size(); i++) {
                UserVo v = list.get(i);
                tableUser.addRow(
                    new Object[] {
                      v.getID(),
                      Methods.eToC(v.getRole()),
                      v.getPassword(),
                      v.getName(),
                      v.getGender(),
                      v.getBirthday(),
                      v.getIc(),
                      v.getDepartment(),
                      v.getRegisterYear(),
                      v.getContact()
                    });
              }
            }
          }
        });
  }
Ejemplo n.º 16
0
  public PanelSpec(SmedAction dia) {
    dlg = dia;
    setLayout(null);
    add(getShapeButton(pillarButton, 0, 0, 34, 32, "Pillar", Shp.PILLAR, Obj.BOYSPP));
    add(getShapeButton(sparButton, 34, 0, 34, 32, "Spar", Shp.SPAR, Obj.BOYSPP));
    add(getShapeButton(canButton, 68, 0, 34, 32, "Can", Shp.CAN, Obj.BOYSPP));
    add(getShapeButton(coneButton, 102, 0, 34, 32, "Cone", Shp.CONI, Obj.BOYSPP));
    add(getShapeButton(sphereButton, 0, 32, 34, 32, "Sphere", Shp.SPHERI, Obj.BOYSPP));
    add(getShapeButton(barrelButton, 34, 32, 34, 32, "Barrel", Shp.BARREL, Obj.BOYSPP));
    add(getShapeButton(superButton, 68, 32, 34, 32, "Super", Shp.SUPER, Obj.BOYSPP));
    add(getShapeButton(floatButton, 102, 32, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT));
    add(getShapeButton(beaconButton, 0, 64, 34, 32, "Beacon", Shp.BEACON, Obj.BCNSPP));
    add(getShapeButton(towerButton, 34, 64, 34, 32, "TowerB", Shp.TOWER, Obj.BCNSPP));
    add(getShapeButton(stakeButton, 68, 64, 34, 32, "Stake", Shp.STAKE, Obj.BCNSPP));
    add(getShapeButton(cairnButton, 102, 64, 34, 32, "CairnB", Shp.CAIRN, Obj.BCNSPP));

    categoryLabel = new JLabel(Messages.getString("Category"), SwingConstants.CENTER);
    categoryLabel.setBounds(new Rectangle(5, 125, 160, 18));
    add(categoryLabel);
    categoryBox = new JComboBox();
    categoryBox.setBounds(new Rectangle(5, 142, 160, 18));
    add(categoryBox);
    categoryBox.setVisible(true);
    categoryBox.addActionListener(alCategoryBox);
    addCatItem("", Cat.NOCAT);
    addCatItem(Messages.getString("UKPurpose"), Cat.SPM_UNKN);
    addCatItem(Messages.getString("Warning"), Cat.SPM_WARN);
    addCatItem(Messages.getString("ChanSeparation"), Cat.SPM_CHBF);
    addCatItem(Messages.getString("Yachting"), Cat.SPM_YCHT);
    addCatItem(Messages.getString("Cable"), Cat.SPM_CABL);
    addCatItem(Messages.getString("Outfall"), Cat.SPM_OFAL);
    addCatItem(Messages.getString("ODAS"), Cat.SPM_ODAS);
    addCatItem(Messages.getString("RecreationZone"), Cat.SPM_RECN);
    addCatItem(Messages.getString("Mooring"), Cat.SPM_MOOR);
    addCatItem(Messages.getString("LANBY"), Cat.SPM_LNBY);
    addCatItem(Messages.getString("Leading"), Cat.SPM_LDNG);
    addCatItem(Messages.getString("Notice"), Cat.SPM_NOTC);
    addCatItem(Messages.getString("TSS"), Cat.SPM_TSS);
    addCatItem(Messages.getString("FoulGround"), Cat.SPM_FOUL);
    addCatItem(Messages.getString("Diving"), Cat.SPM_DIVE);
    addCatItem(Messages.getString("FerryCross"), Cat.SPM_FRRY);
    addCatItem(Messages.getString("Anchorage"), Cat.SPM_ANCH);
    mooringBox = new JComboBox();
    mooringBox.setBounds(new Rectangle(5, 142, 160, 18));
    add(mooringBox);
    mooringBox.setVisible(false);
    mooringBox.addActionListener(alMooringBox);
    addMorItem("", Cat.NOCAT);
    addMorItem(Messages.getString("Dolphin"), Cat.MOR_DLPN);
    addMorItem(Messages.getString("DevDolphin"), Cat.MOR_DDPN);
    addMorItem(Messages.getString("Bollard"), Cat.MOR_BLRD);
    addMorItem(Messages.getString("Wall"), Cat.MOR_WALL);
    addMorItem(Messages.getString("Post"), Cat.MOR_POST);
    addMorItem(Messages.getString("Chain"), Cat.MOR_CHWR);
    addMorItem(Messages.getString("Rope"), Cat.MOR_ROPE);
    addMorItem(Messages.getString("Automatic"), Cat.MOR_AUTO);
    addMorItem(Messages.getString("MooringBuoy"), Cat.MOR_BUOY);
    addMorItem(Messages.getString("CALM"), Cat.INB_CALM);
    addMorItem(Messages.getString("SBM"), Cat.INB_SBM);

    topmarkButton.setBounds(new Rectangle(136, 0, 34, 32));
    topmarkButton.setToolTipText(Messages.getString("Topmark"));
    topmarkButton.setBorder(BorderFactory.createLoweredBevelBorder());
    topmarkButton.addActionListener(alTop);
    add(topmarkButton);

    //		noticeButton.setBounds(new Rectangle(136, 32, 34, 32));
    //		noticeButton.setToolTipText(Messages.getString("Notice"));
    //		noticeButton.setBorder(BorderFactory.createLoweredBevelBorder());
    //		noticeButton.addActionListener(alNotice);
    //		add(noticeButton);

    mooringButton.setBounds(new Rectangle(136, 64, 34, 32));
    mooringButton.setToolTipText(Messages.getString("Mooring"));
    mooringButton.setBorder(BorderFactory.createLoweredBevelBorder());
    mooringButton.addActionListener(alMooring);
    add(mooringButton);
  }
  public void createDataEditPanelCourse(String CourseNo, String CourseName, String CourseCredit) {

    this.CourseNo = CourseNo;
    this.CourseName = CourseName;
    this.CourseCredit = CourseCredit;

    Credit = Float.parseFloat(CourseCredit);

    if (Credit == 0.75) CreditIndex = 0;
    else if (Credit == 1.50) CreditIndex = 1;
    else if (Credit == 3.00) CreditIndex = 2;
    else CreditIndex = 3;

    DEPC = new JDialog();
    DEPC.setTitle("Course Edit Dialog");

    Panel =
        new JPanel() {
          protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(
                new ImageIcon(getClass().getResource("/Icons/8.jpg")).getImage(),
                0,
                0,
                600,
                230,
                null);
            ButtonBorder.paintBorder(this, g, 172, 136, 130, 25);
          }
        };
    Panel.setForeground(Color.WHITE);
    Panel.setLayout(null);

    CourseNoLabel1 = new JLabel("Course No.          : ");
    CourseNoLabel1.setForeground(Color.WHITE);
    CourseNoLabel1.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    CourseNoLabel1.setBounds(77, 29, 139, 27);
    Panel.add(CourseNoLabel1);

    CourseNoLabel2 = new JLabel(this.CourseNo);
    CourseNoLabel2.setForeground(Color.WHITE);
    CourseNoLabel2.setFont(new Font("Rockwell Extra Bold", Font.BOLD, 12));
    CourseNoLabel2.setBounds(213, 29, 200, 27);
    Panel.add(CourseNoLabel2);

    CourseNameLabel = new JLabel("Course Title       :");
    CourseNameLabel.setForeground(Color.WHITE);
    CourseNameLabel.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    CourseNameLabel.setBounds(77, 56, 139, 26);
    Panel.add(CourseNameLabel);

    CourseNameField = new JTextField(this.CourseName);
    CourseNameField.setForeground(Color.WHITE);
    CourseNameField.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 10));
    CourseNameField.setBounds(213, 60, 200, 20);
    CourseNameField.setOpaque(false);
    CourseNameField.setHorizontalAlignment(SwingConstants.CENTER);
    Panel.add(CourseNameField);

    CourseCreditLabel = new JLabel("Course Credit   :");
    CourseCreditLabel.setForeground(Color.WHITE);
    CourseCreditLabel.setBounds(77, 87, 139, 26);
    CourseCreditLabel.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    Panel.add(CourseCreditLabel);

    CourseCreditBox = new JComboBox<String>();
    CourseCreditBox.setBackground(Color.GRAY);
    CourseCreditBox.setForeground(new Color(28, 0, 0));
    CourseCreditBox.setBounds(213, 91, 103, 20);
    CourseCreditBox.setBorder(ButtonBorder);
    CourseCreditBox.addItem("0.75");
    CourseCreditBox.addItem("1.50");
    CourseCreditBox.addItem("3.00");
    CourseCreditBox.addItem("4.00");
    CourseCreditBox.setMaximumRowCount(3);
    CourseCreditBox.setSelectedIndex(CreditIndex);
    Panel.add(CourseCreditBox);

    UpdateButton = new JButton("Update");
    UpdateButton.setForeground(Color.WHITE);
    UpdateButton.setFont(new Font("Rockwell Extra Bold", Font.BOLD, 10));
    UpdateButton.setBounds(173, 137, 128, 23);
    UpdateButton.setContentAreaFilled(false);
    UpdateButton.addActionListener(this);
    Panel.add(UpdateButton);

    DEPC.getContentPane().add(Panel);
    DEPC.setSize(500, 230);
    DEPC.setLocation(500, 200);
    DEPC.setResizable(false);
    DEPC.setVisible(true);
    DEPC.setModal(true);
  }
Ejemplo n.º 18
0
  /** this method is used to design Main UI of Rack manager */
  private void initComponents() {

    label2 = new JLabel();
    panel1 = new JPanel();
    label1 = new JLabel();
    separator1 = new JSeparator();
    comboBox1 = new JComboBox<Object>();
    textField1 = new JTextField();
    label4 = new JLabel();
    label3 = new JLabel();
    scrollPane1 = new JScrollPane();
    textArea1 = new JTextArea();
    button1 = new JButton();
    button2 = new JButton();
    button3 = new JButton();
    button4 = new JButton();
    button5 = new JButton();
    button6 = new JButton();
    scrollPane2 = new JScrollPane();
    tableModel = new DefaultTableModel();
    table1 = new JTable(tableModel);

    // ======== this ========
    setResizable(false);
    Container contentPane = getContentPane();
    contentPane.setLayout(null);

    // ======== panel1 ========
    {
      panel1.setLayout(null);

      // ---- label1 ----
      label1.setText("Manage Rack");
      label1.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 30));
      panel1.add(label1);
      label1.setBounds(200, 10, 400, 50);

      panel1.add(separator1);
      separator1.setBounds(0, 100, 600, 5);

      // ---- label2 ----
      label2.setText("Select Store");
      panel1.add(label2);
      label2.setBounds(100, 120, 150, 20);

      panel1.add(comboBox1);
      comboBox1.setBounds(250, 120, 200, 20);
      comboBox1.addItemListener(this);

      // ---- label3 ----
      label3.setText("<html>Rack Name <font color='red'><b>*</b></font></html>");
      panel1.add(label3);
      label3.setBounds(100, 160, 160, 20);

      panel1.add(textField1);
      textField1.setBounds(250, 160, 200, 20);

      // ---- label4 ----
      label4.setText("Description");
      panel1.add(label4);
      label4.setBounds(100, 200, 150, 20);

      // ======== scrollPane1 ========
      {
        scrollPane1.setViewportView(textArea1);
      }
      panel1.add(scrollPane1);
      scrollPane1.setBounds(250, 200, 200, 100);

      // ---- button1 ----
      button1.setText("Save");
      panel1.add(button1);
      button1.setBounds(100, 350, 100, 30);
      button1.addActionListener(this);

      // ---- button2 ----
      button2.setText("Refresh");
      panel1.add(button2);
      button2.setBounds(250, 350, 100, 30);
      button2.addActionListener(this);

      // ---- button3 ----
      button3.setText("Exit");
      panel1.add(button3);
      button3.setBounds(400, 350, 100, 30);
      button3.addActionListener(this);

      // ---- button4 ----
      button4.setText("View");
      panel1.add(button4);
      button4.setBounds(100, 400, 100, 30);
      button4.addActionListener(this);

      // ---- button5 ----
      button5.setText("Update");
      panel1.add(button5);
      button5.setBounds(250, 400, 100, 30);
      button5.addActionListener(this);

      // ---- button6 ----
      button6.setText("Delete");
      panel1.add(button6);
      button6.setBounds(400, 400, 100, 30);
      button6.addActionListener(this);

      tableModel.addColumn("Sr. No.");
      tableModel.addColumn("Rack Name");

      // ======== scrollPane2 ========
      {
        scrollPane2.setViewportView(table1);
      }
      panel1.add(scrollPane2);
      scrollPane2.setBounds(50, 460, 500, 170);
    }
    contentPane.add(panel1);
    panel1.setBounds(0, 0, 600, 700);

    setTitle("Rack Manager");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    pack();
    setVisible(true);
    // setLocationRelativeTo(getOwner());
    setLocation(100, 10);
    setSize(600, 700);
  }
Ejemplo n.º 19
0
 @SuppressWarnings("serial")
 private void initGUI() {
   try {
     setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
     getContentPane().setLayout(null);
     this.setTitle("Overzicht");
     this.setVisible(true);
     {
       lStart = new JLabel();
       getContentPane().add(lStart);
       lStart.setText("Overzicht");
       lStart.setHorizontalAlignment(SwingConstants.CENTER);
       lStart.setBackground(new java.awt.Color(54, 190, 54));
       lStart.setFont(new java.awt.Font("Arial", 1, 36));
       lStart.setForeground(new java.awt.Color(0, 128, 64));
       lStart.setOpaque(true);
       lStart.setBounds(0, 0, 336, 49);
     }
     {
       pInzet = new JPanel();
       getContentPane().add(pInzet);
       pInzet.setBorder(
           BorderFactory.createTitledBorder(
               null,
               "Selectie",
               TitledBorder.LEADING,
               TitledBorder.DEFAULT_POSITION,
               new java.awt.Font("Tahoma", 1, 11)));
       pInzet.setLayout(null);
       pInzet.setBounds(14, 63, 308, 105);
       pInzet.setFont(new java.awt.Font("Tahoma", 1, 12));
       {
         lMin = new JLabel();
         pInzet.add(lMin);
         lMin.setText("Speler");
         lMin.setFont(new java.awt.Font("Arial", 0, 12));
         lMin.setBounds(17, 59, 62, 27);
       }
       {
         lMax = new JLabel();
         pInzet.add(lMax);
         lMax.setText("Spelronde");
         lMax.setFont(new java.awt.Font("Arial", 0, 12));
         lMax.setBounds(17, 26, 62, 25);
       }
       // Combo voor Spelrondes. Deze wordt eerst geladen. Na selectie
       // wordt de speler gevuld.
       {
         oc = new OverzichtController(this);
         String[] rondes = oc.GeefSpelrondes();
         ComboBoxModel cbSpelRondeModel = new DefaultComboBoxModel(rondes);
         cbSpelRonde = new JComboBox();
         pInzet.add(cbSpelRonde);
         cbSpelRonde.setModel(cbSpelRondeModel);
         cbSpelRonde.setBounds(91, 29, 156, 21);
         cbSpelRonde.setToolTipText("Maak een keuze uit de gespeelde speelronden.");
       }
       {
         bStart = new JButton();
         getContentPane().add(bStart);
         bStart.setText("Sluiten");
         bStart.setFont(new java.awt.Font("Arial", 0, 12));
         bStart.setBounds(196, 303, 75, 23);
         bStart.addActionListener(
             new ActionListener() {
               public void actionPerformed(ActionEvent evt) {
                 bStartActionPerformed(evt);
               }
             });
       }
     }
     pack();
     this.setSize(352, 364);
   } catch (Exception e) {
     e.printStackTrace();
   }
 } // private void initGUI()
Ejemplo n.º 20
0
  /** Initialisation der grafischen Oberfläche. */
  private void initialize() {
    frmAuswertung = new JFrame();
    frmAuswertung.setTitle("Auswertung");
    frmAuswertung.setBounds(100, 100, 671, 235);
    frmAuswertung.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frmAuswertung.setLocationRelativeTo(null);

    menuBar = new JMenuBar();
    frmAuswertung.setJMenuBar(menuBar);

    mnDatei = new JMenu("Datei");
    menuBar.add(mnDatei);

    mnItmLog = new JMenuItem("Protokoll öffnen");
    mnItmLog.addActionListener(this);
    mnDatei.add(mnItmLog);

    mnExport = new JMenu("Exportieren");
    mnDatei.add(mnExport);

    mnItmQExp = new JMenuItem("Quartalsauswertung");
    mnItmQExp.addActionListener(this);
    mnExport.add(mnItmQExp);

    mnItmAExp = new JMenuItem("Auswertung");
    mnItmAExp.addActionListener(this);
    mnExport.add(mnItmAExp);

    mnItmQuit = new JMenuItem("Schlie\u00dfen");
    mnItmQuit.addActionListener(this);
    mnDatei.add(mnItmQuit);

    mnHelp = new JMenu("?");
    menuBar.add(mnHelp);

    mnItmAbout = new JMenuItem("About");
    mnItmAbout.addActionListener(this);
    mnHelp.add(mnItmAbout);
    frmAuswertung.getContentPane().setLayout(null);

    panelQAusw = new JPanel();
    panelQAusw.setBorder(
        new TitledBorder(
            new LineBorder(null, 1, true),
            "Quartalsauswertung",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panelQAusw.setBounds(5, 5, 200, 175);
    frmAuswertung.getContentPane().add(panelQAusw);
    panelQAusw.setLayout(null);

    lblJahr = new JLabel("Jahr:");
    lblJahr.setBounds(12, 25, 70, 15);
    panelQAusw.add(lblJahr);

    lblQuartal = new JLabel("Quartal:");
    lblQuartal.setBounds(12, 65, 70, 15);
    panelQAusw.add(lblQuartal);

    lblUmsatz = new JLabel("Umsatz:");
    lblUmsatz.setBounds(12, 109, 70, 15);
    panelQAusw.add(lblUmsatz);

    lblErgebnis = new JLabel("0,00 EUR");
    lblErgebnis.setHorizontalAlignment(SwingConstants.RIGHT);
    lblErgebnis.setBounds(94, 109, 94, 15);
    panelQAusw.add(lblErgebnis);

    cBoxJahr = new JComboBox<>();
    cBoxJahr.setBounds(123, 20, 65, 24);
    jahre = new Vector<>();
    jahre.add("2012");
    jahre.add("2013");
    jahre.add("2014");
    cBoxJahrModel = new DefaultComboBoxModel<>(jahre);
    cBoxJahr.setModel(cBoxJahrModel);
    panelQAusw.add(cBoxJahr);

    cBoxQuartal = new JComboBox<>();
    cBoxQuartal.setBounds(123, 60, 66, 24);
    quartal = new Vector<>();
    quartal.add("1");
    quartal.add("2");
    quartal.add("3");
    quartal.add("4");
    cBoxQuartalModel = new DefaultComboBoxModel<>(quartal);
    cBoxQuartal.setModel(cBoxQuartalModel);
    panelQAusw.add(cBoxQuartal);

    btnAusw = new JButton("auswerten");
    btnAusw.setBounds(12, 138, 176, 25);
    btnAusw.addActionListener(this);
    panelQAusw.add(btnAusw);

    panelAusw = new JPanel();
    panelAusw.setBorder(
        new TitledBorder(
            new LineBorder(null, 1, true),
            "Auswertung",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panelAusw.setBounds(217, 5, 444, 175);
    frmAuswertung.getContentPane().add(panelAusw);
    panelAusw.setLayout(null);

    lblJahr_1 = new JLabel("Jahr:");
    lblJahr_1.setBounds(12, 25, 70, 15);
    panelAusw.add(lblJahr_1);

    lblQuartal_1 = new JLabel("Quartal:");
    lblQuartal_1.setBounds(12, 65, 70, 15);
    panelAusw.add(lblQuartal_1);

    lblUmsatz_1 = new JLabel("Umsatz:");
    lblUmsatz_1.setBounds(12, 109, 70, 15);
    panelAusw.add(lblUmsatz_1);

    lblErgebnis_2 = new JLabel("0,00 EUR");
    lblErgebnis_2.setHorizontalAlignment(SwingConstants.RIGHT);
    lblErgebnis_2.setBounds(77, 109, 105, 15);
    panelAusw.add(lblErgebnis_2);

    lblEinArt = new JLabel("Einnahmeart:");
    lblEinArt.setBounds(200, 25, 107, 15);
    panelAusw.add(lblEinArt);

    lblMitglied = new JLabel("Mitglied:");
    lblMitglied.setBounds(200, 65, 70, 15);
    panelAusw.add(lblMitglied);

    lblMenge = new JLabel("Menge:");
    lblMenge.setBounds(12, 143, 70, 15);
    panelAusw.add(lblMenge);

    lblMengeErg = new JLabel("0 St.");
    lblMengeErg.setHorizontalAlignment(SwingConstants.RIGHT);
    lblMengeErg.setBounds(94, 143, 89, 15);
    panelAusw.add(lblMengeErg);

    cBoxJahr2 = new JComboBox<>();
    cBoxJahr2.setBounds(116, 20, 66, 24);
    cBoxJahr2.setModel(cBoxJahrModel);
    panelAusw.add(cBoxJahr2);

    cBoxQuartal2 = new JComboBox<>();
    cBoxQuartal2.setBounds(116, 60, 66, 24);
    cBoxQuartal2.setModel(cBoxQuartalModel);
    panelAusw.add(cBoxQuartal2);

    cBoxEinArt = new JComboBox<>();
    einnahmeArt = new Vector<>();
    einnahmeArt.add("Tageskarte");
    einnahmeArt.add("Shopartikel");
    einnahmeArt.add("Event");
    einnahmeArt.add("Jahresgeb\u00FChr");
    cBoxEinArtModel = new DefaultComboBoxModel<>(einnahmeArt);
    cBoxEinArt.setModel(cBoxEinArtModel);
    cBoxEinArt.setBounds(320, 20, 112, 24);
    panelAusw.add(cBoxEinArt);

    cBoxMitglied = new JComboBox<>();
    mitglied = new Vector<>();
    mitglied.add("101");
    mitglied.add("102");
    mitglied.add("103");
    mitglied.add("104");
    mitglied.add("106");
    cBoxMitgliedModel = new DefaultComboBoxModel<>(mitglied);
    cBoxMitglied.setModel(cBoxMitgliedModel);
    cBoxMitglied.setBounds(366, 60, 66, 24);
    panelAusw.add(cBoxMitglied);

    btnAusw2 = new JButton("auswerten");
    btnAusw2.setBounds(315, 138, 117, 25);
    btnAusw2.addActionListener(this);
    panelAusw.add(btnAusw2);
  }
  public startbooking1() {
    // construct preComponents
    String[] jcb_mmItems = {"3", "4"};
    String[] jcb_ddItems = {
      "2", "3", "4", "5", "6", "7", "8", "9", "10", "13", "14", "15", "16", "17", "18", "20", "21",
      "22", "23", "24", "27", "28", "30"
    };
    String[] jcb_matItems = {"RCB vs RR", "CSK vs KXIP"};
    String[] jcb_standItems = {"A", "B", "Pavilion", "Terrace"};

    // construct components
    jlbl_date = new JLabel("Date:");
    jcb_mm = new JComboBox(jcb_mmItems);
    jcb_dd = new JComboBox(jcb_ddItems);
    jl_match = new JLabel("Match:");
    jcb_mat = new JComboBox(jcb_matItems);
    jl_stand = new JLabel("Stand:");
    jcb_stand = new JComboBox(jcb_standItems);
    jlbl_tic = new JLabel("No of Tickets:");
    jt_tic = new JTextField(1);
    jl_price = new JLabel("Price:");
    jt_price = new JTextField(1);
    jl_rupee = new JLabel("```");
    jb_chkav = new JButton("Check Availability");
    jb_booknow = new JButton("Book Now");
    jb_choose = new JButton("Choose");
    jb_home = new JButton("Home");
    jl_gilly = new JLabel("Gilly");
    jl_yuvi = new JLabel("Yuvi");
    jl_yn = new JLabel("yes/no");

    // set components properties
    jcb_stand.setEnabled(false);
    jt_price.setEnabled(false);
    jb_booknow.setEnabled(false);
    jb_choose.setEnabled(false);

    // adjust size and set layout
    setPreferredSize(new Dimension(560, 435));
    setLayout(null);

    // add components
    add(jlbl_date);
    add(jcb_mm);
    add(jcb_dd);
    add(jl_match);
    add(jcb_mat);
    add(jl_stand);
    add(jcb_stand);
    add(jlbl_tic);
    add(jt_tic);
    add(jl_price);
    add(jt_price);
    add(jl_rupee);
    add(jb_chkav);
    add(jb_booknow);
    add(jb_choose);
    add(jb_home);
    add(jl_gilly);
    add(jl_yuvi);
    add(jl_yn);

    // set component bounds (only needed by Absolute Positioning)
    jlbl_date.setBounds(170, 80, 35, 25);
    jcb_mm.setBounds(250, 80, 35, 25);
    jcb_dd.setBounds(290, 80, 35, 25);
    jl_match.setBounds(170, 110, 50, 25);
    jcb_mat.setBounds(250, 110, 100, 25);
    jl_stand.setBounds(170, 140, 40, 25);
    jcb_stand.setBounds(250, 140, 60, 25);
    jlbl_tic.setBounds(260, 205, 85, 25);
    jt_tic.setBounds(340, 205, 45, 25);
    jl_price.setBounds(170, 235, 40, 25);
    jt_price.setBounds(265, 235, 100, 25);
    jl_rupee.setBounds(240, 235, 20, 25);
    jb_chkav.setBounds(170, 170, 135, 25);
    jb_booknow.setBounds(170, 265, 130, 25);
    jb_choose.setBounds(170, 205, 80, 25);
    jb_home.setBounds(305, 265, 80, 25);
    jl_gilly.setBounds(10, 80, 135, 210);
    jl_yuvi.setBounds(430, 80, 135, 210);
    jl_yn.setBounds(320, 170, 80, 25);
  }
Ejemplo n.º 22
0
  // panneau millieu
  public void initPanneauMillieuComponents() {
    int x_Pos = milieu.getX() + 100;

    // textTitre = new JTextField();
    textTitre.setBounds(x_Pos, labels[2].getY() - 5, 360, 25);
    infos_film[0] = new JLabel();
    infos_film[0].setBounds(x_Pos, labels[2].getY() - 5, 360, 25);

    // textAnnee = new JTextField();
    textAnnee.setBounds(x_Pos, labels[3].getY() - 5, 360, 25);
    infos_film[1] = new JLabel();
    infos_film[1].setBounds(x_Pos, labels[3].getY() - 5, 360, 25);

    // comboType = new JComboBox();
    comboType.addItem("");
    comboType.addItem("FILM");
    comboType.addItem("SERIE TV");
    comboType.setBounds(x_Pos, labels[4].getY(), 360, 20);
    infos_film[2] = new JLabel();
    infos_film[2].setBounds(x_Pos, labels[4].getY(), 360, 20);

    // comboEval = new JComboBox();
    comboEval.addItem("");
    comboEval.addItem("1 etoile");
    comboEval.addItem("2 etoiles");
    comboEval.addItem("3 etoiles");
    comboEval.addItem("4 etoiles");
    comboEval.addItem("5 etoiles");
    comboEval.setBounds(x_Pos, labels[5].getY(), 360, 20);
    infos_film[3] = new JLabel();
    infos_film[3].setBounds(x_Pos, labels[5].getY(), 360, 20);

    scrollCom.setBounds(x_Pos, labels[6].getY(), 360, 65);
    scrollCom.setBorder(new LineBorder(GRIS_FONCE, 1));

    scrollCat.setBounds(x_Pos, labels[7].getY(), 180, 70);
    scrollCat.setBorder(new LineBorder(GRIS_FONCE, 1));

    textCommentaires.setLineWrap(true);
    textCommentaires.setWrapStyleWord(true);

    optionCategories[0] = new JButton("Ajouter categorie");
    optionCategories[0].setBounds(
        scrollCat.getX() + scrollCat.getWidth() + 15, scrollCat.getY() + 5, 155, 20);

    optionCategories[1] = new JButton("Supprimer categorie");
    optionCategories[1].setBounds(
        scrollCat.getX() + scrollCat.getWidth() + 15, scrollCat.getY() + 45, 155, 20);

    for (int i = 0; i < infos_film.length; i++) {
      milieu.add(infos_film[i]);
    }

    milieu.add(textTitre);
    milieu.add(textAnnee);
    milieu.add(comboType);
    milieu.add(comboEval);
    milieu.add(scrollCom);
    milieu.add(scrollCat);
    milieu.add(optionCategories[0]);
    milieu.add(optionCategories[1]);
  }
Ejemplo n.º 23
0
  public PanelMore(OSeaMAction dia) {
    dlg = dia;
    setLayout(null);
    panelPat = new PanelPat(dlg, Ent.BODY);
    panelPat.setBounds(new Rectangle(0, 0, 110, 160));
    add(panelPat);
    add(getRegionButton(regionAButton, 110, 0, 34, 30, "RegionA"));
    add(getRegionButton(regionBButton, 110, 32, 34, 30, "RegionB"));
    add(getRegionButton(regionCButton, 110, 64, 34, 30, "RegionC"));

    elevLabel = new JLabel(Messages.getString("Elevation"), SwingConstants.CENTER);
    elevLabel.setBounds(new Rectangle(140, 0, 90, 20));
    add(elevLabel);
    elevBox = new JTextField();
    elevBox.setBounds(new Rectangle(160, 20, 50, 20));
    elevBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(elevBox);
    elevBox.addFocusListener(flElev);

    heightLabel = new JLabel(Messages.getString("Height"), SwingConstants.CENTER);
    heightLabel.setBounds(new Rectangle(140, 40, 90, 20));
    add(heightLabel);
    heightBox = new JTextField();
    heightBox.setBounds(new Rectangle(160, 60, 50, 20));
    heightBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(heightBox);
    heightBox.addFocusListener(flHeight);

    sourceLabel = new JLabel(Messages.getString("Source"), SwingConstants.CENTER);
    sourceLabel.setBounds(new Rectangle(110, 80, 130, 20));
    add(sourceLabel);
    sourceBox = new JTextField();
    sourceBox.setBounds(new Rectangle(110, 100, 130, 20));
    sourceBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(sourceBox);
    sourceBox.addFocusListener(flSource);

    infoLabel = new JLabel(Messages.getString("Information"), SwingConstants.CENTER);
    infoLabel.setBounds(new Rectangle(110, 120, 130, 20));
    add(infoLabel);
    infoBox = new JTextField();
    infoBox.setBounds(new Rectangle(110, 140, 130, 20));
    infoBox.setHorizontalAlignment(SwingConstants.CENTER);
    add(infoBox);
    infoBox.addFocusListener(flInfo);

    statusLabel = new JLabel(Messages.getString("Status"), SwingConstants.CENTER);
    statusLabel.setBounds(new Rectangle(250, 0, 100, 20));
    add(statusLabel);
    statusBox = new JComboBox();
    statusBox.setBounds(new Rectangle(250, 20, 100, 20));
    addStsItem("", Sts.UNKSTS);
    addStsItem(Messages.getString("Permanent"), Sts.PERM);
    addStsItem(Messages.getString("Occasional"), Sts.OCC);
    addStsItem(Messages.getString("Recommended"), Sts.REC);
    addStsItem(Messages.getString("NotInUse"), Sts.NIU);
    addStsItem(Messages.getString("Intermittent"), Sts.INT);
    addStsItem(Messages.getString("Reserved"), Sts.RESV);
    addStsItem(Messages.getString("Temporary"), Sts.TEMP);
    addStsItem(Messages.getString("Private"), Sts.PRIV);
    addStsItem(Messages.getString("Mandatory"), Sts.MAND);
    addStsItem(Messages.getString("Destroyed"), Sts.DEST);
    addStsItem(Messages.getString("Extinguished"), Sts.EXT);
    addStsItem(Messages.getString("Illuminated"), Sts.ILLUM);
    addStsItem(Messages.getString("Historic"), Sts.HIST);
    addStsItem(Messages.getString("Public"), Sts.PUB);
    addStsItem(Messages.getString("Synchronized"), Sts.SYNC);
    addStsItem(Messages.getString("Watched"), Sts.WATCH);
    addStsItem(Messages.getString("UnWatched"), Sts.UNWAT);
    addStsItem(Messages.getString("Doubtful"), Sts.DOUBT);
    add(statusBox);
    statusBox.addActionListener(alStatus);

    constrLabel = new JLabel(Messages.getString("Construction"), SwingConstants.CENTER);
    constrLabel.setBounds(new Rectangle(250, 40, 100, 20));
    add(constrLabel);
    constrBox = new JComboBox();
    constrBox.setBounds(new Rectangle(250, 60, 100, 20));
    addCnsItem("", Cns.UNKCNS);
    addCnsItem(Messages.getString("Masonry"), Cns.BRICK);
    addCnsItem(Messages.getString("Concreted"), Cns.CONC);
    addCnsItem(Messages.getString("Boulders"), Cns.BOULD);
    addCnsItem(Messages.getString("HardSurfaced"), Cns.HSURF);
    addCnsItem(Messages.getString("Unsurfaced"), Cns.USURF);
    addCnsItem(Messages.getString("Wooden"), Cns.WOOD);
    addCnsItem(Messages.getString("Metal"), Cns.METAL);
    addCnsItem(Messages.getString("GRP"), Cns.GLAS);
    addCnsItem(Messages.getString("Painted"), Cns.PAINT);
    add(constrBox);
    constrBox.addActionListener(alConstr);

    conLabel = new JLabel(Messages.getString("Conspicuity"), SwingConstants.CENTER);
    conLabel.setBounds(new Rectangle(250, 80, 100, 20));
    add(conLabel);
    conBox = new JComboBox();
    conBox.setBounds(new Rectangle(250, 100, 100, 20));
    addConItem("", Con.UNKCON);
    addConItem(Messages.getString("Conspicuous"), Con.CONSP);
    addConItem(Messages.getString("NotConspicuous"), Con.NCONS);
    add(conBox);
    conBox.addActionListener(alCon);

    reflLabel = new JLabel(Messages.getString("Reflectivity"), SwingConstants.CENTER);
    reflLabel.setBounds(new Rectangle(250, 120, 100, 20));
    add(reflLabel);
    reflBox = new JComboBox();
    reflBox.setBounds(new Rectangle(250, 140, 100, 20));
    addReflItem("", Con.UNKCON);
    addReflItem(Messages.getString("Conspicuous"), Con.CONSP);
    addReflItem(Messages.getString("NotConspicuous"), Con.NCONS);
    addReflItem(Messages.getString("Reflector"), Con.REFL);
    add(reflBox);
    reflBox.addActionListener(alRefl);
  }
Ejemplo n.º 24
0
  /**
   * Constructeur de recherche
   *
   * @param titre
   * @throws IOException
   */
  public Recherche(String titre) throws IOException {
    setTitle(titre);
    // Container conteneur=this.getContentPane();
    // conteneur.setLayout(new BorderLayout(2,1));
    switchcherche = 0;
    setSize(1200, 800);
    InputStream input = img.class.getResourceAsStream("med.jpg");
    JPanel panneau = new PanelImage(input);
    panneau.setLayout(null);

    // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    String[] typeRecherche = {
      "Docteur", "Malade", "Chambre", "Employe", "Infirmier", "Service", "Hospitalisation", "Soigne"
    };

    rechercheDesire = new JLabel();
    rechercheDesire.setText("                               Selectionner une table :");
    rechercheDesire.setBounds(400, 120, 400, 40);
    rechercheDesire.setBackground(Color.lightGray);
    rechercheDesire.setOpaque(true);
    panneau.add(rechercheDesire);

    rechercheDesireBox = new JComboBox();
    for (int i = 0; i < typeRecherche.length; i++) {
      rechercheDesireBox.insertItemAt(typeRecherche[i], i);
    }
    rechercheDesireBox.setBounds(400, 160, 400, 80);
    panneau.add(rechercheDesireBox);

    explication = new JLabel();
    explication.setBounds(200, 240, 800, 40);
    panneau.add(explication);
    explication.setBackground(Color.LIGHT_GRAY);
    explication.setOpaque(true);
    explication.setText(
        "                                                    Pour tout afficher : ne rien saisir dans les lignes de recherche");

    rech1 = new JLabel();
    rech1.setBounds(200, 300, 200, 50);
    rech1.setText("              Recherche 1");
    rech1.setBackground(Color.LIGHT_GRAY);
    rech1.setOpaque(true);
    panneau.add(rech1);

    recherche1 = new JTextField("");
    recherche1.setBounds(400, 300, 200, 50);
    // this.add("South",result1);
    panneau.add(recherche1);

    result1 = new JComboBox();
    result1.setBounds(600, 300, 400, 50);
    panneau.add(result1);

    rech2 = new JLabel();
    rech2.setBounds(200, 370, 200, 50);
    rech2.setText("              Recherche 2");
    rech2.setBackground(Color.lightGray);
    rech2.setOpaque(true);
    panneau.add(rech2);

    recherche2 = new JTextField("");
    recherche2.setBounds(400, 370, 200, 50);
    // this.add("South",result2);
    panneau.add(recherche2);

    result2 = new JComboBox();
    result2.setBounds(600, 370, 400, 50);
    panneau.add(result2);

    rech3 = new JLabel();
    rech3.setBounds(200, 440, 200, 50);
    rech3.setText("              Recherche 3");
    rech3.setBackground(Color.lightGray);
    rech3.setOpaque(true);
    panneau.add(rech3);

    recherche3 = new JTextField("");
    recherche3.setBounds(400, 440, 200, 50);
    panneau.add(recherche3);

    result3 = new JComboBox();
    result3.setBounds(600, 440, 400, 50);
    panneau.add(result3);

    exit = new JButton("Retour");
    exit.setForeground(Color.red);
    exit.setBounds(430, 700, 160, 40);

    valider = new JButton("Rechercher");
    // valider.setForeground(Color.green);
    valider.setBounds(610, 700, 160, 40);
    panneau.add(valider);
    panneau.add(exit);

    rechercheDesireBox.addActionListener(this);
    recherche1.addActionListener(this);
    recherche2.addActionListener(this);
    recherche3.addActionListener(this);
    valider.addActionListener(this);
    exit.addActionListener(this);

    //  conteneur.add(panneau);
    fentreCard.add("Recherche", panneau);
    setVisible(false);
  }
Ejemplo n.º 25
0
  /** Create the frame. */
  public SotrudnikDialog() {
    setTitle(
        "\u041D\u043E\u0432\u044B\u0439 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    setBounds(100, 100, 450, 330);
    contentPane = new JPanel();
    contentPane.setBackground(new Color(255, 204, 255));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel label_familiya = new JLabel("\u0424\u0430\u043C\u0438\u043B\u0438\u044F");
    label_familiya.setBounds(10, 37, 110, 14);
    contentPane.add(label_familiya);

    JLabel label_imya = new JLabel("\u0418\u043C\u044F");
    label_imya.setBounds(10, 62, 110, 14);
    contentPane.add(label_imya);

    JLabel label_otchestvo = new JLabel("\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E");
    label_otchestvo.setBounds(10, 87, 110, 14);
    contentPane.add(label_otchestvo);

    textField_otchestvo = new JTextField();
    textField_otchestvo.setBounds(167, 84, 186, 20);
    contentPane.add(textField_otchestvo);
    textField_otchestvo.setColumns(10);

    textField_imya = new JTextField();
    textField_imya.setBounds(167, 58, 186, 20);
    contentPane.add(textField_imya);
    textField_imya.setColumns(10);

    textField_familiya = new JTextField();
    textField_familiya.setBounds(167, 33, 186, 20);
    contentPane.add(textField_familiya);
    textField_familiya.setColumns(10);

    JLabel label_data_priema =
        new JLabel(
            "\u0414\u0430\u0442\u0430 \u043F\u0440\u0438\u0435\u043C\u0430 \u043D\u0430 \u0440\u0430\u0431\u043E\u0442\u0443");
    label_data_priema.setBounds(10, 112, 147, 14);
    contentPane.add(label_data_priema);

    JLabel label_phone = new JLabel("\u0422\u0435\u043B\u0435\u0444\u043E\u043D");
    label_phone.setBounds(10, 137, 134, 14);
    contentPane.add(label_phone);

    JLabel label_doljnost = new JLabel("\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C");
    label_doljnost.setBounds(10, 162, 140, 14);
    contentPane.add(label_doljnost);

    JLabel label_kvalification =
        new JLabel("\u041A\u0432\u0430\u043B\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F");
    label_kvalification.setBounds(10, 190, 147, 14);
    contentPane.add(label_kvalification);

    textField_phone = new JTextField();
    textField_phone.setBounds(167, 134, 186, 20);
    contentPane.add(textField_phone);
    textField_phone.setColumns(10);

    textField_date.setBounds(167, 109, 186, 20);
    contentPane.add(textField_date);

    label_id_hidden.setFont(new Font("Tahoma", Font.BOLD, 12));
    label_id_hidden.setBounds(143, 11, 122, 14);
    contentPane.add(label_id_hidden);

    button_insert.setBounds(83, 230, 160, 23);
    contentPane.add(button_insert);

    button_cancel.setBounds(264, 230, 104, 23);
    contentPane.add(button_cancel);

    button_update.setBounds(83, 230, 160, 23);
    contentPane.add(button_update);

    JButton button_plus_doljnost = new JButton("+");
    button_plus_doljnost.addActionListener(
        new ActionListener() {
          @SuppressWarnings("deprecation")
          public void actionPerformed(ActionEvent arg0) {
            DoljnostDialog d = new DoljnostDialog();
            d.setTitle("Добавление должности");
            d.show();
          }
        });
    button_plus_doljnost.setBounds(359, 159, 41, 23);
    contentPane.add(button_plus_doljnost);

    JButton button_plus_kvalification = new JButton("+");
    button_plus_kvalification.addActionListener(
        new ActionListener() {
          @SuppressWarnings("deprecation")
          public void actionPerformed(ActionEvent arg0) {
            KvalificationDialog d = new KvalificationDialog();
            d.setTitle("Добавление квалификации");
            d.show();
          }
        });
    button_plus_kvalification.setBounds(359, 184, 41, 23);
    contentPane.add(button_plus_kvalification);

    JLabel label =
        new JLabel(
            "\u041F\u043E\u043B\u044F, \u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043D\u044B\u0435 ");
    label.setBounds(60, 264, 122, 14);
    contentPane.add(label);

    JLabel label_3 = new JLabel("*");
    label_3.setForeground(Color.RED);
    label_3.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_3.setBounds(186, 264, 12, 14);
    contentPane.add(label_3);

    JLabel label_4 =
        new JLabel(
            "\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B  \u0434\u043B\u044F \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F!");
    label_4.setBounds(197, 264, 203, 14);
    contentPane.add(label_4);

    JLabel label_5 = new JLabel("*");
    label_5.setForeground(Color.RED);
    label_5.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_5.setBounds(356, 37, 12, 14);
    contentPane.add(label_5);

    JLabel label_1 = new JLabel("*");
    label_1.setForeground(Color.RED);
    label_1.setFont(new Font("Tahoma", Font.BOLD, 11));
    label_1.setBounds(356, 62, 12, 14);
    contentPane.add(label_1);

    comboBox_doljnost.setBounds(167, 159, 186, 20);
    contentPane.add(comboBox_doljnost);

    comboBox_kvalification.setBounds(167, 187, 186, 20);
    contentPane.add(comboBox_kvalification);

    // Actions for button "Добавить"
    button_insert.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (!textField_familiya.getText().equals("") && !textField_imya.getText().equals("")) {
              try {
                Sotrudnik s = new Sotrudnik();
                s.setFamiliya(textField_familiya.getText());
                s.setImya(textField_imya.getText());
                s.setOtchestvo(textField_otchestvo.getText());
                s.setData_priema(Date.valueOf(textField_date.getText()));
                s.setPhone(textField_phone.getText());
                Doljnost d = (Doljnost) comboBox_doljnost.getSelectedItem();
                s.setId_doljnosti(d.getId_doljnosti());
                Kvalification k = (Kvalification) comboBox_kvalification.getSelectedItem();
                s.setId_kvalification(k.getId_kvalification());

                DBClass db = new DBClass();
                db.sotrudnikUpsert(s, "INSERT");
                MyFrame.updateList();
                ZakazDialog.updateSotrudnik();
              } catch (SQLException e) {
                e.printStackTrace();
                JOptionPane.showMessageDialog(panelException, e.getMessage());
              } catch (ClassNotFoundException ee) {
                ee.printStackTrace();
                JOptionPane.showMessageDialog(panelException, ee.getMessage());
              } finally {
                dispose();
              }
            } else JOptionPane.showMessageDialog(null, "Введите обязательные параметры!");
          }
        });

    // Actions for button "Отмена"
    button_cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            dispose();
          }
        });

    // Actions for button "Сохранить изменения"
    button_update.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (!textField_familiya.getText().equals("")
                && !textField_imya.getText().equals("")
                && !textField_date.getText().equals("")) {
              if (textField_date.getText().length() == 10) {
                try {
                  Integer.parseInt((textField_date.getText().substring(0, 3)));
                  Integer.parseInt((textField_date.getText().substring(5, 6)));
                  Integer.parseInt((textField_date.getText().substring(8, 9)));

                  Sotrudnik s = new Sotrudnik();
                  s.setId_sotrudnika(Integer.parseInt(label_id_hidden.getText()));
                  s.setFamiliya(textField_familiya.getText());
                  s.setImya(textField_imya.getText());
                  s.setOtchestvo(textField_otchestvo.getText());
                  s.setPhone(textField_phone.getText());

                  Doljnost d = (Doljnost) comboBox_doljnost.getSelectedItem();
                  s.setId_doljnosti(d.getId_doljnosti());

                  Kvalification k = (Kvalification) comboBox_kvalification.getSelectedItem();
                  s.setId_kvalification(k.getId_kvalification());

                  DBClass db = new DBClass();
                  db.sotrudnikUpsert(s, "UPDATE");
                  MyFrame.updateList();
                  dispose();
                } catch (NumberFormatException e) {
                  JOptionPane.showMessageDialog(panelException, e.getMessage());
                } catch (SQLException e) {
                  // e.printStackTrace();
                  JOptionPane.showMessageDialog(panelException, e.getMessage());
                } catch (ClassNotFoundException ee) {
                  // ee.printStackTrace();
                  JOptionPane.showMessageDialog(panelException, ee.getMessage());
                }
              } else JOptionPane.showMessageDialog(null, "Введите дату в правильном формате!");
            } else JOptionPane.showMessageDialog(null, "Введите обязательные параметры!");
          }
        });
  }
Ejemplo n.º 26
0
  private void InitUI() {
    System.out.println("Create new Opportunity");

    setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    add(Box.createRigidArea(new Dimension(0, 35)));

    eventTsText = new JTextField("2011-07-11 11:00:00.000 +0:00");
    eventTsLabel = new JLabel();

    try {
      ownerId =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\employees.txt"));
      ownerId.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }

    ownerIdLabel = new JLabel();

    try {
      accountId =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\accounts.txt"));
      accountId.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }
    accountIdLabel = new JLabel();

    try {
      leadSource =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\leadSources.txt"));
      leadSource.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }
    leadSourceLabel = new JLabel();

    ECDText = new JTextField("2011-07-11");
    ECDLabel = new JLabel();

    amountText = new JTextField("1000");
    amountLabel = new JLabel();

    nameText = new JTextField("");
    nameLabel = new JLabel();

    descriptionText = new JTextField("");
    descriptionLabel = new JLabel();

    stageNameText = new JTextField("");
    stageNameLabel = new JLabel();

    stageDescrText = new JTextField("");
    stageDescrLabel = new JLabel();

    statusText = new JTextField("");
    statusLabel = new JLabel();

    resultText = new JTextField("");
    resultLabel = new JLabel();

    isClosed = new JCheckBox("IsClosed");
    isWon = new JCheckBox("IsWon");

    createButton = new JButton("Create");
    cleanFormButton = new JButton("Clean Form");
    generateSQLButton = new JButton("Generate SQL");

    ownerId.setBounds(210, 20, 190, 30);
    ownerIdLabel.setBounds(30, 20, 150, 30);
    ownerIdLabel.setText("Owner ID");

    accountId.setBounds(210, 50, 190, 30);
    accountIdLabel.setBounds(30, 50, 150, 30);
    accountIdLabel.setText("Account ID");

    leadSource.setBounds(210, 80, 190, 30);
    leadSourceLabel.setBounds(30, 80, 150, 30);
    leadSourceLabel.setText("Lead Source");

    eventTsText.setBounds(210, 110, 190, 30);
    eventTsLabel.setBounds(30, 110, 150, 30);
    eventTsLabel.setText("Event TS");

    ECDText.setBounds(210, 140, 190, 30);
    ECDLabel.setBounds(30, 140, 150, 30);
    ECDLabel.setText("Expected Close Date");

    amountText.setBounds(210, 170, 150, 30);
    amountLabel.setBounds(30, 170, 80, 30);
    amountLabel.setText("Amount");

    nameText.setBounds(210, 200, 150, 30);
    nameLabel.setBounds(30, 200, 80, 30);
    nameLabel.setText("Name");

    descriptionText.setBounds(210, 230, 150, 30);
    descriptionLabel.setBounds(30, 230, 80, 30);
    descriptionLabel.setText("Description");

    stageNameText.setBounds(210, 260, 150, 30);
    stageNameLabel.setBounds(30, 260, 80, 30);
    stageNameLabel.setText("Stage Name");

    stageDescrText.setBounds(210, 290, 150, 30);
    stageDescrLabel.setBounds(30, 290, 80, 30);
    stageDescrLabel.setText("Stage Description");

    statusText.setBounds(210, 320, 150, 30);
    statusLabel.setBounds(30, 320, 80, 30);
    statusLabel.setText("Status");

    resultText.setBounds(210, 350, 150, 30);
    resultLabel.setBounds(30, 350, 80, 30);
    resultLabel.setText("Result");

    isClosed.setBounds(30, 380, 90, 30);
    isWon.setBounds(210, 380, 90, 30);

    createButton.setBounds(20, 420, 90, 30);
    cleanFormButton.setBounds(125, 420, 120, 30);
    generateSQLButton.setBounds(260, 420, 120, 30);

    setLayout(null);

    add(ownerId);
    add(ownerIdLabel);

    add(accountId);
    add(accountIdLabel);

    add(leadSource);
    add(leadSourceLabel);

    add(eventTsLabel);
    add(eventTsText);

    add(ECDText);
    add(ECDLabel);

    add(amountText);
    add(amountLabel);

    add(nameText);
    add(nameLabel);

    add(descriptionText);
    add(descriptionLabel);

    add(stageNameText);
    add(stageNameLabel);

    add(stageDescrText);
    add(stageDescrLabel);

    add(statusText);
    add(statusLabel);

    add(resultText);
    add(resultLabel);

    add(isClosed);
    add(isWon);

    add(createButton);
    add(cleanFormButton);
    add(generateSQLButton);

    setSize(420, 510);
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);
    setVisible(true);
  }
Ejemplo n.º 27
0
 private void relayout() {
   int preferredHeight = b.getPreferredSize().height;
   b.setBounds(0, topOffset, getWidth(), preferredHeight);
 }
  private void jbInit() throws Exception {

    final JLabel textAndFont = new JLabel(Messages.getMessage("PdfViewerLabel.TextAndFont"));
    textAndFont.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
    textAndFont.setDisplayedMnemonic('0');
    textAndFont.setBounds(new Rectangle(13, 13, 220, 26));

    final JLabel left = new JLabel(Messages.getMessage("PdfViewerLabel.Left"));
    left.setBounds(new Rectangle(130, 40, 50, 23));

    final JLabel center = new JLabel(Messages.getMessage("PdfViewerLabel.Center"));
    center.setBounds(new Rectangle(300, 40, 50, 23));

    final JLabel right = new JLabel(Messages.getMessage("PdfViewerLabel.Right"));
    right.setBounds(new Rectangle(475, 40, 50, 23));

    final JLabel header = new JLabel(Messages.getMessage("PdfViewerLabel.Header"));
    header.setBounds(new Rectangle(20, 60, 90, 23));

    final JLabel footer = new JLabel(Messages.getMessage("PdfViewerLabel.Footer"));
    footer.setBounds(new Rectangle(20, 90, 50, 23));

    leftHeaderBox.setBounds(new Rectangle(85, 60, 133, 23));
    centerHeaderBox.setBounds(new Rectangle(250, 60, 133, 23));
    rightHeaderBox.setBounds(new Rectangle(425, 60, 133, 23));

    leftFooterBox.setBounds(new Rectangle(85, 90, 133, 23));
    centerFooterBox.setBounds(new Rectangle(250, 90, 133, 23));
    rightFooterBox.setBounds(new Rectangle(425, 90, 133, 23));

    final JLabel font = new JLabel(Messages.getMessage("PdfViewerLabel.Font"));
    font.setBounds(new Rectangle(20, 120, 75, 23));

    fontsList.setBounds(new Rectangle(85, 120, 150, 23));
    fontsList.setSelectedItem("Helvetica");

    final JLabel size = new JLabel(Messages.getMessage("PdfViewerLabel.Size"));
    size.setBounds(new Rectangle(250, 120, 50, 23));

    fontSize.setBounds(new Rectangle(290, 120, 50, 23));

    final JLabel color = new JLabel(Messages.getMessage("PdfViewerLabel.Color"));
    color.setBounds(new Rectangle(360, 120, 50, 23));

    colorBox.setBackground(Color.black);
    colorBox.setOpaque(true);
    colorBox.setBounds(new Rectangle(410, 120, 23, 23));

    final JButton chooseColor = new JButton(Messages.getMessage("PdfViewerButton.ChooseColor"));
    chooseColor.setBounds(new Rectangle(450, 120, 160, 23));
    chooseColor.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            colorBox.setBackground(
                JColorChooser.showDialog(null, "Color", colorBox.getBackground()));
          }
        });

    tagsList.setText(
        "You may use the following\n"
            + "tags as part of the text.\n\n"
            + "<d> - Date in short format\n"
            + "<D> - Date in long format\n"
            + "<t> - Time in 12-hour format\n"
            + "<T> - Time in 24-hour format\n"
            + "<f> - Filename\n"
            + "<F> - Full path filename\n"
            + "<p> - Current page number\n"
            + "<P> - Total number of pages");
    tagsList.setOpaque(false);
    tagsList.setBounds(350, 160, 200, 210);

    final JLabel margins = new JLabel(Messages.getMessage("PdfViewerLabel.Margins"));

    margins.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
    margins.setDisplayedMnemonic('0');
    margins.setBounds(new Rectangle(13, 150, 220, 26));

    final JLabel leftRight = new JLabel(Messages.getMessage("PdfViewerLabel.LeftAndRight"));
    leftRight.setBounds(new Rectangle(20, 185, 90, 23));

    leftRightBox.setBounds(new Rectangle(100, 185, 70, 23));

    final JLabel topBottom = new JLabel(Messages.getMessage("PdfViewerLabel.TopAndBottom"));
    topBottom.setBounds(new Rectangle(180, 185, 120, 23));

    topBottomBox.setBounds(new Rectangle(300, 185, 70, 23));

    pageRangeLabel.setText(Messages.getMessage("PdfViewerPageRange.text"));
    pageRangeLabel.setBounds(new Rectangle(13, 220, 400, 26));

    printAll.setText(Messages.getMessage("PdfViewerRadioButton.All"));
    printAll.setBounds(new Rectangle(23, 250, 75, 22));

    printCurrent.setText(Messages.getMessage("PdfViewerRadioButton.CurrentPage"));
    printCurrent.setBounds(new Rectangle(23, 270, 100, 22));
    printCurrent.setSelected(true);

    printPages.setText(Messages.getMessage("PdfViewerRadioButton.Pages"));
    printPages.setBounds(new Rectangle(23, 292, 70, 22));

    pagesBox.setBounds(new Rectangle(95, 292, 230, 22));
    pagesBox.addKeyListener(
        new KeyListener() {
          @Override
          public void keyPressed(final KeyEvent arg0) {}

          @Override
          public void keyReleased(final KeyEvent arg0) {
            if (pagesBox.getText().isEmpty()) {
              printCurrent.setSelected(true);
            } else {
              printPages.setSelected(true);
            }
          }

          @Override
          public void keyTyped(final KeyEvent arg0) {}
        });

    final JTextArea pagesInfo =
        new JTextArea(Messages.getMessage("PdfViewerMessage.PageNumberOrRangeLong"));
    pagesInfo.setBounds(new Rectangle(23, 320, 620, 40));
    pagesInfo.setOpaque(false);

    this.add(printAll, null);
    this.add(printCurrent, null);

    this.add(printPages, null);
    this.add(pagesBox, null);
    this.add(pagesInfo, null);

    this.add(left, null);
    this.add(center, null);
    this.add(right, null);
    this.add(header, null);
    this.add(footer, null);
    this.add(leftHeaderBox, null);
    this.add(centerHeaderBox, null);
    this.add(rightHeaderBox, null);
    this.add(leftFooterBox, null);
    this.add(centerFooterBox, null);
    this.add(rightFooterBox, null);
    this.add(font, null);
    this.add(fontsList, null);
    this.add(size, null);
    this.add(fontSize, null);
    this.add(color, null);
    this.add(colorBox, null);
    this.add(chooseColor, null);
    this.add(margins, null);
    this.add(leftRight, null);
    this.add(leftRightBox, null);
    this.add(topBottom, null);
    this.add(topBottomBox, null);

    this.add(textAndFont, null);
    this.add(changeButton, null);
    this.add(pageRangeLabel, null);

    // this.add(tagsList, null);

    this.add(jToggleButton2, null);
    this.add(jToggleButton3, null);

    buttonGroup1.add(printAll);
    buttonGroup1.add(printCurrent);
    buttonGroup1.add(printPages);
  }
Ejemplo n.º 29
0
    private void initComponents() {
      label1 = new JLabel();
      comboBox1 = new JComboBox();
      button1 = new JButton();

      // ======== this ========
      setTitle("SneakyFarmer");
      Container contentPane = getContentPane();
      contentPane.setLayout(null);

      // ---- label1 ----
      label1.setText("Which herb to farm:");
      label1.setFont(label1.getFont().deriveFont(label1.getFont().getSize() + 1f));
      contentPane.add(label1);
      label1.setBounds(10, 10, 125, 35);

      // ---- comboBox1 ----
      comboBox1.setModel(
          new DefaultComboBoxModel(
              new String[] {
                "Guam",
                "Marrentill",
                "Tarromin",
                "Harralander",
                "Ranarr",
                "Toadflax",
                "Irit",
                "Avantoe",
                "Kwuarm",
                "Snapdragon",
                "Cadantine",
                "Lantadyme",
                "Dwarf Weed",
                "Torstol"
              }));
      contentPane.add(comboBox1);
      comboBox1.setBounds(135, 10, 90, 35);

      // ---- button1 ----
      button1.setText("Start Farming!");
      button1.setFont(button1.getFont().deriveFont(button1.getFont().getSize() + 7f));
      contentPane.add(button1);
      button1.setBounds(10, 50, 215, 35);
      button1.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              startActionPerformed(e);
            }
          });

      { // compute preferred size
        Dimension preferredSize = new Dimension();
        for (int i = 0; i < contentPane.getComponentCount(); i++) {
          Rectangle bounds = contentPane.getComponent(i).getBounds();
          preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
          preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        }
        Insets insets = contentPane.getInsets();
        preferredSize.width += insets.right;
        preferredSize.height += insets.bottom;
        contentPane.setMinimumSize(preferredSize);
        contentPane.setPreferredSize(preferredSize);
      }
      pack();
      setLocationRelativeTo(getOwner());
    }
Ejemplo n.º 30
0
  public void initComponents() {
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setBounds(100, 100, 902, 597);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    panel_4 = new JPanel();
    panel_4.setBorder(
        new TitledBorder(
            new LineBorder(new Color(0, 0, 0)),
            "Geral",
            TitledBorder.LEFT,
            TitledBorder.TOP,
            null,
            null));
    panel_4.setBounds(10, 11, 426, 236);
    contentPane.add(panel_4);
    panel_4.setLayout(null);

    lblModeloDoAutomato = new JLabel("Defini\u00E7\u00E3o do Automato:");
    lblModeloDoAutomato.setBounds(10, 47, 125, 14);
    panel_4.add(lblModeloDoAutomato);

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane_2.setBounds(10, 72, 406, 124);
    panel_4.add(scrollPane_2);

    textArea = new JTextArea();
    textArea.setColumns(100);
    scrollPane_2.setColumnHeaderView(textArea);
    textArea.setAutoscrolls(true);
    textArea.setRows(9);

    JButton btnMinimizar = new JButton("Minimizar");
    btnMinimizar.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            minimizarAutomato();
          }
        });
    btnMinimizar.setBounds(10, 207, 104, 23);
    panel_4.add(btnMinimizar);

    JPanel panel = new JPanel();
    panel.setBounds(10, 15, 250, 25);
    panel_4.add(panel);
    panel.setBorder(null);
    panel.setLayout(null);

    JLabel lblNome = new JLabel("Criar estado:");
    lblNome.setBounds(10, 5, 82, 14);
    panel.add(lblNome);
    lblNome.setHorizontalAlignment(SwingConstants.CENTER);

    isfinal = new JCheckBox("Final");
    isfinal.setBounds(98, 1, 56, 23);
    panel.add(isfinal);

    btnNovo = new JButton("Novo");
    btnNovo.setBounds(160, 1, 73, 23);
    panel.add(btnNovo);
    btnNovo.addActionListener(
        new ActionListener() {

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

    JPanel panel_5 = new JPanel();
    panel_5.setBorder(
        new TitledBorder(
            new LineBorder(new Color(0, 0, 0)),
            "Visualiza\u00E7\u00E3o",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panel_5.setBounds(10, 258, 1310, 390);
    contentPane.add(panel_5);
    panel_5.setLayout(null);

    painelView = new JPanelVisualizacao(this);
    painelView.setBounds(10, 22, 1290, 357);
    panel_5.add(painelView);

    JPanel panel_2 = new JPanel();
    panel_2.setBounds(558, 11, 314, 251);
    contentPane.add(panel_2);
    panel_2.setLayout(null);

    lblNewLabel = new JLabel("Detalhes de ");
    lblNewLabel.setBounds(10, 11, 152, 14);
    panel_2.add(lblNewLabel);

    cbisFinal = new JCheckBox("Final");
    cbisFinal.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseClicked(MouseEvent arg0) {
            turnFinal();
          }
        });
    cbisFinal.setBounds(168, 7, 60, 23);
    panel_2.add(cbisFinal);

    btnExcluir = new JButton("Excluir");
    btnExcluir.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            excluirEstado();
          }
        });
    btnExcluir.setBounds(231, 7, 73, 23);
    panel_2.add(btnExcluir);

    panel_3 = new JPanel();
    panel_3.setBorder(
        new TitledBorder(
            new LineBorder(new Color(0, 0, 0)),
            "Transi\u00E7\u00F5es",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panel_3.setBounds(10, 36, 294, 204);
    panel_2.add(panel_3);
    panel_3.setLayout(null);

    JLabel lblSimbolo = new JLabel("Simbolo:");
    lblSimbolo.setBounds(10, 29, 96, 14);
    panel_3.add(lblSimbolo);

    cbAlfabeto = new JComboBox();
    cbAlfabeto.setBounds(122, 26, 49, 20);
    panel_3.add(cbAlfabeto);

    JLabel lblEstadosDestinos = new JLabel("Estados Destinos:");
    lblEstadosDestinos.setBounds(10, 57, 96, 14);
    panel_3.add(lblEstadosDestinos);

    cbEstadosDestinos = new JComboBox();
    cbEstadosDestinos.setBounds(122, 54, 49, 20);
    panel_3.add(cbEstadosDestinos);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(10, 82, 274, 111);
    panel_3.add(scrollPane_1);

    tblTrans = new JTable();
    scrollPane_1.setViewportView(tblTrans);

    btnNova = new JButton("Nova");
    btnNova.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            novaTransicao();
          }
        });
    btnNova.setBounds(181, 25, 89, 23);
    panel_3.add(btnNova);

    btnRemover = new JButton("Remover");
    btnRemover.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            removerTransicao();
          }
        });
    btnRemover.setBounds(181, 53, 89, 23);
    panel_3.add(btnRemover);

    JPanel panel_1 = new JPanel();
    panel_1.setBorder(
        new TitledBorder(
            new LineBorder(new Color(0, 0, 0)),
            "Estados",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panel_1.setBounds(446, 11, 102, 236);
    contentPane.add(panel_1);
    panel_1.setLayout(null);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 26, 82, 199);
    panel_1.add(scrollPane);

    tblEstados = new JTable();
    scrollPane.setViewportView(tblEstados);
    tblEstados.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mouseClicked(MouseEvent arg0) {
            selecionaEstadoAtual(a.getEstados().get(tblEstados.getSelectedRow()));
          }
        });
    tblEstados.setAutoscrolls(true);
    tblEstados.add(new Scrollbar());
  }