Пример #1
0
  public OpponentFrame(final Server ss) {
    thiss = this;
    this.server = ss;
    update = new Timer();
    setResizable(false);
    setTitle("player list -  Sinius Chess");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 249, 323);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    list = new JList<String>();
    list.setValueIsAdjusting(true);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    update.schedule(
        new TimerTask() {
          @Override
          public void run() {
            list.setListData(server.getOnlinePlayers());
          }
        },
        1,
        3000);
    list.setBounds(10, 62, 221, 189);
    contentPane.add(list);

    JLabel lblConnectedTo = new JLabel("Connected to " + server.ip + ":" + server.port);
    lblConnectedTo.setBounds(10, 12, 221, 14);
    contentPane.add(lblConnectedTo);

    JLabel lblOnlinePlayers = new JLabel("online players:");
    lblOnlinePlayers.setBounds(10, 37, 96, 14);
    contentPane.add(lblOnlinePlayers);

    JButton btnChalange = new JButton("Chalange Player");
    btnChalange.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (list.getSelectedValue() == null) {
              JOptionPane.showMessageDialog(
                  thiss, "Select an opponent", "No opponent selected", JOptionPane.ERROR_MESSAGE);
              return;
            }
            if (list.getSelectedValue().equals(ss.myName)) {
              JOptionPane.showMessageDialog(
                  thiss,
                  "Cannot play against yourself",
                  "chose an other opponent",
                  JOptionPane.ERROR_MESSAGE);
              return;
            }
            server.sendMessage(
                new Message("client" + server.id, "match_request", list.getSelectedValue()));
          }
        });
    btnChalange.setBounds(10, 263, 221, 23);
    contentPane.add(btnChalange);
  }
Пример #2
0
  /** Create the frame. */
  public BrowseModule() {
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 800, 600);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JPanel panel = new JPanel();
    panel.setBorder(
        new TitledBorder(
            null, "Vehicle Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panel.setBounds(16, 10, 376, 291);
    contentPane.add(panel);
    panel.setLayout(null);

    list = new JList<String>(listStr);
    list.setBounds(6, 16, 364, 268);
    panel.add(list);
    list.setFont(new Font("Arial", Font.PLAIN, 16));
    list.addListSelectionListener(this);

    JPanel panel_1 = new JPanel();
    panel_1.setBorder(
        new TitledBorder(
            null, "Vehicle Example", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panel_1.setBounds(399, 10, 381, 291);
    contentPane.add(panel_1);
    panel_1.setLayout(null);

    lblNewLabel = new JLabel();
    lblNewLabel.setBounds(6, 16, 369, 268);
    panel_1.add(lblNewLabel);
    lblNewLabel.setIcon(pics[0]);

    panel_2 = new JPanel();
    panel_2.setBorder(
        new TitledBorder(
            null,
            "Additional Equipment/Services",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panel_2.setBounds(122, 316, 512, 198);
    contentPane.add(panel_2);
    panel_2.setLayout(null);

    label = new JLabel();
    label.setBounds(6, 16, 500, 175);
    panel_2.add(label);
    label.setText(
        "<HTML>GPS Receiver - $15/day<BR>Child Seat - $10/day<BR>K-TAG Rental - $2/day (plus accumulated tolls)"
            + "<BR>Roadside Assistance - $7/day<BR>Loss Damage Waiver Insurance - $25/day<BR>Personal Accident Insurance - $5/day</HTML>");
  }
Пример #3
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 526, 301);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    list = new JList();
    list.setBounds(12, 12, 426, 219);
    JScrollPane scroll = new JScrollPane(list);
    scroll.setBounds(12, 12, 502, 219);
    frame.getContentPane().add(scroll);
    dlm = new DefaultListModel<>();
    list.setModel(dlm);

    textField = new JTextField();
    textField.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
              btnNewButton.doClick();
            }
          }
        });
    textField.setBounds(12, 243, 403, 30);
    frame.getContentPane().add(textField);
    textField.setColumns(10);

    btnNewButton = new JButton("Send");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            System.out.println("Clicked!");
            String msg = textField.getText().toString();
            if (TextUtils.isEmpty(msg)) return;
            System.out.println("Creating new msg!");
            ChatMessage chatMessage = new ChatMessage(msg, true, new Date());
            addMessageToContainer(chatMessage);

            textField.setText("");
            prsr.sendMsgQueue.add(chatMessage);
          }
        });
    btnNewButton.setFont(new Font("Dialog", Font.BOLD, 10));
    btnNewButton.setBounds(425, 243, 89, 30);
    frame.getContentPane().add(btnNewButton);
  }
Пример #4
0
  public SettingsDialog(final MainWindow window, final Scene scene, final SceneRenderer renderer) {
    super(window);
    setResizable(false);
    setAlwaysOnTop(true);
    setSize(550, 420);
    setTitle("Settings");
    setLocationRelativeTo(window);
    getContentPane().setLayout(new BorderLayout());

    optionsPanel = new JPanel();
    optionsPanel.setLayout(optionsLayout = new CardLayout());
    optionsPanel.add(new RendererSettings(scene, renderer), menus[0]);
    optionsPanel.add(new SubSettings(scene, renderer), menus[1]);
    optionsPanel.add(new RobotSettings(scene, renderer), menus[2]);
    optionsPanel.add(new ObstacleSettings(scene, renderer), menus[3]);
    optionsPanel.add(new PathSettings(scene, renderer), menus[4]);
    optionsPanel.add(new SumSettings(scene, renderer), menus[5]);
    optionsPanel.add(new ContactSettings(scene, renderer), menus[6]);
    getContentPane().add(optionsPanel, BorderLayout.CENTER);

    JPanel bottomPanel = new JPanel();
    FlowLayout fl_bottomPanel = (FlowLayout) bottomPanel.getLayout();
    fl_bottomPanel.setAlignment(FlowLayout.RIGHT);
    bottomPanel.setBorder(new MatteBorder(1, 0, 0, 0, (Color) Color.GRAY));
    getContentPane().add(bottomPanel, BorderLayout.SOUTH);

    menuList = new JList(new MenuModel());
    menuList.setCellRenderer(new MenuRenderer());
    menuList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    menuList.setPreferredSize(new Dimension(100, 0));
    menuList.setBorder(new MatteBorder(0, 0, 0, 1, (Color) Color.GRAY));
    menuList.setBounds(17, 20, 99, 241);
    menuList.addListSelectionListener(new MenuListener());
    menuList.setSelectedIndex(0);
    getContentPane().add(menuList, BorderLayout.WEST);

    JButton btnOk = new JButton("OK");
    btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            SettingsDialog.this.setVisible(false);
          }
        });
    bottomPanel.add(btnOk);
  }
Пример #5
0
  public WizardFrame() {
    List<Class<?>> agentClasses =
        RSApplication.getRSApplicationInstance()
            .getCurrentScenario()
            .getContext()
            .getAgentClasses(true);

    for (Class a : agentClasses) {
      if (AggregatorAgent.class.isAssignableFrom(a) && !Modifier.isAbstract(a.getModifiers())) {
        WizardFrame.aggregatorClasses.add(a);
      } else if (ProsumerAgent.class.isAssignableFrom(a)
          && !Modifier.isAbstract(a.getModifiers())) {
        WizardFrame.prosumerClasses.add(a);
      }
    }

    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder;
    try {
      docBuilder = docFactory.newDocumentBuilder();
      this.config = docBuilder.newDocument();
      Element rootElement = this.config.createElement("context");
      this.config.appendChild(rootElement);
    } catch (ParserConfigurationException e) {
      System.err.println("Couldn't configure parser to produce an XML document");
      e.printStackTrace();
    }

    this.setTitle("Cascade Context configuration wizard");
    this.setSize(WizardFrame.WIZARD_WINDOW_DEFAULT_WIDTH, WizardFrame.WIZARD_WINDOW_DEFAULT_HEIGHT);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    WizardPane contentPanel =
        new WizardPane(
            this.config,
            WizardFrame.WIZARD_WINDOW_DEFAULT_WIDTH,
            WizardFrame.WIZARD_WINDOW_DEFAULT_HEIGHT);
    this.getContentPane().add(contentPanel);
    JList list = new JList();
    list.setBounds(135, 107, 1, 1);
    contentPanel.add(list);
    this.setVisible(true);
  }
  /**
   * Create the _view.
   *
   * @throws SQLException
   */
  public RemoveReaderInternalFrame(ILibrary library) throws SQLException {
    _model = library;

    setTitle("Remove Reader");
    int textFieldCharactersLimit = 25;
    setClosable(true);
    setBounds(100, 100, 600, 300);
    getContentPane().setLayout(null);

    _textFieldSearch = new JTextField();
    _textFieldSearch.setBounds(170, 236, 244, 23);
    _textFieldSearch.setToolTipText("Search Field");
    _textFieldSearch.setColumns(10);
    _textFieldSearch.setDocument(new JTextFieldLimit(textFieldCharactersLimit));
    getContentPane().add(_textFieldSearch);

    _readerModel = new DefaultListModel<Reader>();
    _filteredListModel = new FilteredListModel(_readerModel);

    _readersList = new JList<Reader>(_filteredListModel);
    _readersList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            setEnabledBtnRemoveReader(true);
          }
        });
    _readersList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    _readersList.setBounds(10, 52, 414, 173);

    _btnRemoveReader = new JButton("Remove Reader");
    _btnRemoveReader.setEnabled(false);
    _btnRemoveReader.setBounds(10, 236, 150, 23);
    getContentPane().add(_btnRemoveReader);

    _btnCancel = new JButton("Cancel");
    _btnCancel.setBounds(424, 236, 150, 23);
    getContentPane().add(_btnCancel);

    JScrollPane scrollPane = new JScrollPane(_readersList);
    scrollPane.setBounds(10, 11, 564, 214);
    getContentPane().add(scrollPane);
  }
Пример #7
0
  /** Initialize the contents of the frame. */
  @SuppressWarnings({"unchecked", "rawtypes"})
  private void initialize() {
    frmCompletedQuests = new JFrame();
    frmCompletedQuests.setTitle("Completed Quests");
    frmCompletedQuests.setBounds(100, 100, 493, 467);
    frmCompletedQuests.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmCompletedQuests.getContentPane().setLayout(null);

    list1 = new JList(ymlMgr.model);
    list1.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            String l = list1.getSelectedValue().toString();
            ymlMgr.popForm(l);
          }
        });
    list1.setBounds(10, 36, 457, 381);
    frmCompletedQuests.getContentPane().add(list1);

    JLabel lblClickAQuest = new JLabel("Click a quest to load into editor:");
    lblClickAQuest.setBounds(10, 11, 457, 14);
    frmCompletedQuests.getContentPane().add(lblClickAQuest);
  }
Пример #8
0
  public SeleccionarClubFrm() {
    setTitle("Nuevo fichaje");
    getContentPane().setLayout(null);
    this.setSize(400, 400);

    lblSeleccioneElClub = new JLabel("Seleccione el club que va a realizar el fichaje");
    lblSeleccioneElClub.setFont(new Font("Tahoma", Font.BOLD, 12));
    lblSeleccioneElClub.setHorizontalAlignment(SwingConstants.CENTER);
    lblSeleccioneElClub.setBounds(10, 42, 364, 14);
    getContentPane().add(lblSeleccioneElClub);
    list = new JList<clsClub>();
    LinkedList<clsClub> clubes = new LinkedList<clsClub>();
    try {
      clubes = ges.ListaClubes();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    ListaClubesMdl modelo = new ListaClubesMdl(clubes);
    list.setModel(modelo);
    list.setBounds(50, 84, 280, 211);
    list.addListSelectionListener(this);
    getContentPane().add(list);

    btnAceptar = new JButton("Aceptar");
    btnAceptar.setBounds(60, 306, 89, 23);
    btnAceptar.setEnabled(false);
    btnAceptar.addActionListener(this);
    btnAceptar.setActionCommand("aceptar");
    getContentPane().add(btnAceptar);

    btnCancelar = new JButton("Cancelar");
    btnCancelar.addActionListener(this);
    btnCancelar.setActionCommand("cancelar");
    btnCancelar.setBounds(232, 306, 89, 23);
    getContentPane().add(btnCancelar);
  }
Пример #9
0
  /* public static void main(String[] args)
  {
    JFrame frame1 = new JFrame("Edición Datos");

    ConstruccionesPanel geopistaEditarDatos = new ConstruccionesPanel(10);

    frame1.getContentPane().add(geopistaEditarDatos);
    frame1.setSize(675, 725);
    frame1.setVisible(true);
    frame1.setLocation(150, 90);

  }*/
  private void jbInit() throws Exception {
    this.setName("Construcciones");
    this.setLayout(null);
    this.setSize(new java.awt.Dimension(676, 552));
    // Actualizamos el arraylist
    Construcciones.add(cmbreparto1cons);
    Construcciones.add(cmbreparto2cons);
    Construcciones.add(cmbreparto3cons);
    Construcciones.add(txtBloque);
    Construcciones.add(txtEscalera);
    Construcciones.add(txtPlanta);
    Construcciones.add(txtPuerta);
    Construcciones.add(txtdestinocons);
    Construcciones.add(cmbreformacons);
    Construcciones.add(txtannoreforma);
    Construcciones.add(txtSuperficie_Total_Local);
    Construcciones.add(txtSuperficie_Terrazas_Local);
    Construcciones.add(txtSuperficie_Imputable_Local);
    Construcciones.add(txttipologiacons);
    Construcciones.add(cmbusocons);
    Construcciones.add(txtcategoriacons);
    Construcciones.add(cmbtipovalorcons);
    Construcciones.add(txtapreciacioncons);
    Construcciones.add(txtannoexpcons);
    Construcciones.add(txtreferenciacons);
    Construcciones.add(chkIndicador_Local_Interior);
    Construcciones.add(chkviviendacons);

    jPanel7.setLayout(null);
    jPanel7.setBorder(BorderFactory.createTitledBorder("Datos Físicos"));
    lblSuperficie_Imputable_Local.setText("Superficie Imputable:");
    lblSuperficie_Imputable_Local.setBounds(new java.awt.Rectangle(430, 51, 106, 16));
    txtSuperficie_Imputable_Local.setText("");
    txtSuperficie_Imputable_Local.setBounds(new java.awt.Rectangle(542, 48, 65, 20));
    txtSuperficie_Imputable_Local.setSize(new Dimension(65, 20));
    lblSuperficie_Terrazas_Local.setText("Superficie Porches/Terrazas:");
    lblSuperficie_Terrazas_Local.setBounds(new java.awt.Rectangle(179, 51, 151, 16));
    txtSuperficie_Terrazas_Local.setText("");
    txtSuperficie_Terrazas_Local.setBounds(new Rectangle(345, 50, 65, 20));
    txtSuperficie_Terrazas_Local.setPreferredSize(new Dimension(53, 20));
    txtSuperficie_Terrazas_Local.setSize(new Dimension(65, 20));
    txtSuperficie_Total_Local.setText("");
    txtSuperficie_Total_Local.setBounds(new Rectangle(105, 50, 65, 20));
    supsolarlbl1.setText("Superficie Total:");
    supsolarlbl1.setBounds(new java.awt.Rectangle(10, 54, 88, 17));
    jPanel8.setLayout(null);
    jPanel8.setBorder(BorderFactory.createTitledBorder("Domicilio Tributario"));
    lblEscalera.setText("Escalera:");
    lblEscalera.setBounds(new java.awt.Rectangle(100, 23, 57, 16));
    lblBloque.setText("Bloque:");
    lblBloque.setBounds(new java.awt.Rectangle(6, 20, 43, 15));
    txtBloque.setText("");
    txtBloque.setBounds(new Rectangle(55, 20, 35, 20));
    txtEscalera.setText("");
    txtEscalera.setBounds(new Rectangle(165, 20, 40, 20));
    lblPlanta.setText("Planta:");
    lblPlanta.setBounds(new java.awt.Rectangle(220, 23, 54, 15));
    txtPlanta.setText("");
    txtPlanta.setBounds(new Rectangle(280, 20, 35, 20));
    lblPuerta.setText("Puerta:");
    lblPuerta.setBounds(new java.awt.Rectangle(327, 22, 47, 16));
    txtPuerta.setText("");
    txtPuerta.setBounds(new Rectangle(390, 20, 40, 20));
    jPanel18.setLayout(null);
    jPanel18.setBorder(BorderFactory.createTitledBorder("Identificación"));
    cmbreformacons.setBounds(new Rectangle(265, 20, 45, 20));
    reformaconslbl.setText("Tipo Reforma:");
    reformaconslbl.setBounds(new java.awt.Rectangle(164, 20, 82, 17));
    txtannoreforma.setText("");
    txtannoreforma.setBounds(new Rectangle(415, 20, 45, 20));
    lblAnio_Reforma.setText("Año Reforma:");
    lblAnio_Reforma.setBounds(new java.awt.Rectangle(335, 21, 74, 18));
    txtdestinocons.setText("");
    txtdestinocons.setBounds(new Rectangle(100, 20, 40, 20));
    txtdestinocons.setSize(new Dimension(40, 20));
    lblCodigo_Destino_DGC.setText("Código Destino:");
    lblCodigo_Destino_DGC.setBounds(new java.awt.Rectangle(11, 23, 85, 15));
    chkIndicador_Local_Interior.setText("Local Interior");
    chkIndicador_Local_Interior.setBounds(new Rectangle(480, 20, 110, 20));
    jPanel17.setLayout(null);
    jPanel17.setBorder(BorderFactory.createTitledBorder("Datos de Valoración"));
    txtapreciacioncons.setText("");
    txtapreciacioncons.setBounds(new Rectangle(245, 120, 40, 20));
    lblCorrector_Apreciacion_Economica.setText("Apreciación / Depreciación Económica:");
    lblCorrector_Apreciacion_Economica.setBounds(new java.awt.Rectangle(18, 120, 195, 17));
    coef1lbl4.setText(
        "Coeficientes Correctores Conjuntos del Valor del Suelo y de las Construcciones.");
    coef1lbl4.setBounds(new java.awt.Rectangle(5, 90, 405, 16));
    chkviviendacons.setText("Vivienda / Local Interior");
    chkviviendacons.setBounds(new Rectangle(355, 120, 195, 20));
    cmbusocons.setBounds(new java.awt.Rectangle(301, 23, 170, 20));
    TIPOLOGIACONSLBL.setText("Tipología Constructiva:");
    TIPOLOGIACONSLBL.setBounds(new java.awt.Rectangle(8, 26, 117, 18));
    txttipologiacons.setText("");
    txttipologiacons.setBounds(new Rectangle(135, 25, 50, 20));
    tipoviaparlbl3.setText("Uso Predominante:");
    tipoviaparlbl3.setBounds(new java.awt.Rectangle(195, 27, 96, 15));
    txtcategoriacons.setText("");
    txtcategoriacons.setBounds(new java.awt.Rectangle(565, 22, 25, 20));
    categoriaconslbl.setText("Categoría:");
    categoriaconslbl.setBounds(new java.awt.Rectangle(490, 25, 64, 17));
    cmbreparto1cons.setBounds(new Rectangle(125, 60, 115, 20));
    tipoviaparlbl4.setText("Modalidad Reparto:");
    tipoviaparlbl4.setBounds(new java.awt.Rectangle(12, 60, 104, 17));
    cmbreparto2cons.setBounds(new Rectangle(250, 60, 115, 20));
    cmbreparto3cons.setBounds(new Rectangle(375, 60, 115, 20));
    cmbtipovalorcons.setBounds(new Rectangle(560, 60, 50, 20));
    tipovalorconslbl.setText("Tipo Valor:");
    tipovalorconslbl.setBounds(new java.awt.Rectangle(495, 61, 58, 17));
    jPanel19.setLayout(null);
    jPanel19.setBorder(BorderFactory.createTitledBorder("Datos del Movimiento"));
    jPanel19.setBounds(new Rectangle(15, 430, 625, 95));
    referenciaconslbl.setText("Referencia Expediente:");
    referenciaconslbl.setBounds(new java.awt.Rectangle(185, 20, 130, 19));
    txtreferenciacons.setText("");
    txtreferenciacons.setBounds(new java.awt.Rectangle(319, 20, 110, 20));
    txtreferenciacons.setSize(new Dimension(110, 20));
    annoexpconslbl.setText("Año Expediente:");
    annoexpconslbl.setBounds(new java.awt.Rectangle(13, 18, 95, 21));
    txtannoexpcons.setText("");
    txtannoexpcons.setBounds(new Rectangle(110, 20, 40, 20));
    txtannoexpcons.setPreferredSize(new Dimension(53, 20));
    txtannoexpcons.setSize(new Dimension(40, 20));
    txtcargocons.setText("");
    txtcargocons.setBounds(new Rectangle(475, 35, 50, 20));
    lblNumero_Cargo.setText("Nº Cargo al que se imputa:");
    lblNumero_Cargo.setBounds(new java.awt.Rectangle(340, 39, 130, 16));

    btnBorrarConstruccion.setText("Baja");
    btnBorrarConstruccion.setBounds(new Rectangle(155, 35, 78, 20));
    btnModificarConstruccion.setText("Aplicar");
    btnModificarConstruccion.setBounds(new Rectangle(25, 65, 78, 20));
    btnModificarConstruccion.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            btnModificarConstruccion_actionPerformed(e);
          }
        });
    btnNuevaConstruccion.setText("Alta");
    btnNuevaConstruccion.setBounds(new Rectangle(155, 10, 78, 20));
    btnNuevaConstruccion.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            btnNuevaConstruccion_actionPerformed(e);
          }
        });
    annoexpconslbl1.setText("Fecha Alta:");
    annoexpconslbl1.setBounds(new Rectangle(30, 480, 95, 20));
    txtFechaAlta.setBounds(new Rectangle(130, 480, 100, 20));
    txtFechaBaja.setBounds(new Rectangle(370, 480, 100, 20));
    annoexpconslbl2.setText("Fecha Baja:");
    annoexpconslbl2.setBounds(new Rectangle(270, 480, 95, 20));
    padronModel.setBounds(new Rectangle(5, 5, 100, 55));
    cmbreformacons.addItem("R");
    cmbreformacons.addItem("E");
    cmbreformacons.addItem("O");
    cmbreformacons.addItem("I");
    cmbreformacons.addItem(" ");
    cmbreparto1cons.addItem("T - A todos");
    cmbreparto1cons.addItem("A - A alguno");
    cmbreparto2cons.addItem("L - A locales");
    cmbreparto2cons.addItem("C - A cargos");
    cmbreparto3cons.addItem("1 - Por partes");
    cmbreparto3cons.addItem("2 - Por superficie de los locales");
    cmbreparto3cons.addItem("3 - Por coeficiente de propiedad");
    cmbreparto3cons.addItem("4 - Por coeficiente específicamente determinado");
    cmbtipovalorcons.addItem("0");
    cmbtipovalorcons.addItem("1");
    cmbtipovalorcons.addItem("2");
    cmbtipovalorcons.addItem("3");
    cmbtipovalorcons.addItem("4");
    cmbtipovalorcons.addItem("5");
    cmbtipovalorcons.addItem("6");
    cmbtipovalorcons.addItem("7");
    cmbtipovalorcons.addItem("8");
    cmbtipovalorcons.addItem("9");
    cmbtipovalorcons.addItem("N");
    jPanel19.add(referenciaconslbl, null);
    jPanel19.add(txtreferenciacons, null);
    jPanel19.add(annoexpconslbl, null);
    jPanel19.add(txtannoexpcons, null);
    jPanel17.add(tipovalorconslbl, null);
    jPanel17.add(cmbtipovalorcons, null);
    jPanel17.add(cmbreparto3cons, null);
    jPanel17.add(cmbreparto2cons, null);
    jPanel17.add(tipoviaparlbl4, null);
    jPanel17.add(cmbreparto1cons, null);
    jPanel17.add(categoriaconslbl, null);
    jPanel17.add(txtcategoriacons, null);
    jPanel17.add(txtapreciacioncons, null);
    jPanel17.add(lblCorrector_Apreciacion_Economica, null);
    jPanel17.add(coef1lbl4, null);
    jPanel17.add(chkviviendacons, null);
    jPanel17.add(cmbusocons, null);
    jPanel17.add(TIPOLOGIACONSLBL, null);
    jPanel17.add(txttipologiacons, null);
    jPanel17.add(tipoviaparlbl3, null);
    cmbusocons.addItem("V - Vivienda");
    jPanel18.add(padronModel, null);
    jPanel18.add(btnNuevaConstruccion, null);
    jPanel18.add(btnModificarConstruccion, null);
    jPanel18.add(btnBorrarConstruccion, null);
    jPanel18.add(lblNumero_Cargo, null);
    jPanel18.add(txtcargocons, null);
    jPanel7.add(chkIndicador_Local_Interior, null);
    jPanel7.add(lblCodigo_Destino_DGC, null);
    jPanel7.add(txtdestinocons, null);
    jPanel7.add(lblAnio_Reforma, null);
    jPanel7.add(txtannoreforma, null);
    jPanel7.add(reformaconslbl, null);
    jPanel7.add(cmbreformacons, null);
    jPanel7.add(lblSuperficie_Imputable_Local, null);
    jPanel7.add(txtSuperficie_Imputable_Local, null);
    jPanel7.add(lblSuperficie_Terrazas_Local, null);
    jPanel7.add(txtSuperficie_Terrazas_Local, null);
    jPanel7.add(txtSuperficie_Total_Local, null);
    jPanel7.add(supsolarlbl1, null);
    jPanel7.setBounds(17, 178, 625, 85);
    jPanel17.setBounds(18, 270, 610, 145);
    jPanel18.setBounds(16, 19, 625, 90);
    this.add(annoexpconslbl2, null);
    this.add(txtFechaBaja, null);
    this.add(txtFechaAlta, null);
    this.add(jPanel18, null);
    jPanel8.add(txtPuerta, null);
    jPanel8.add(lblPuerta, null);
    jPanel8.add(txtPlanta, null);
    jPanel8.add(lblPlanta, null);
    jPanel8.add(lblEscalera, null);
    jPanel8.add(lblBloque, null);
    jPanel8.add(txtBloque, null);
    jPanel8.add(txtEscalera, null);
    jPanel8.setBounds(16, 115, 625, 55);
    this.add(jPanel8, null);
    this.add(jPanel7, null);
    this.add(jPanel17, null);
    jPanel19.setBounds(17, 428, 625, 50);
    this.add(jPanel19, null);
    this.add(annoexpconslbl1, null);

    MouseListener mouseListener =
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            String cargo = padronModel.getSelectedValue().toString();
            Iterator alIt1 = Construcciones.iterator();

            while (alIt1.hasNext()) {
              try {
                JComponent comp = (JComponent) alIt1.next();
                if (comp instanceof JTextField) ((JTextField) comp).setText("");
                if (comp instanceof JCheckBox) ((JCheckBox) comp).setSelected(false);
                if (comp instanceof JComboBox) ((JComboBox) comp).setSelectedIndex(0);
              } catch (Exception A) {
                A.printStackTrace();
              }
            }
            CatastroActualizarPostgre Construcc = new CatastroActualizarPostgre();
            ArrayList Datos = Construcc.DatosConstrucciones(cargo, ID_Parcela);
            Iterator alIt = Datos.iterator();
            Iterator itControles = Construcciones.iterator();
            txtcargocons.setText(cargo);
            Object obj;
            ID_Construccion = ((obj = alIt.next()) != null) ? obj.toString() : "";
            String Reparto = ((obj = alIt.next()) != null) ? obj.toString() : "";

            ((JComboBox) itControles.next()).setSelectedItem(Reparto.substring(0, 1));
            ((JComboBox) itControles.next()).setSelectedItem(Reparto.substring(1, 2));
            ((JComboBox) itControles.next()).setSelectedItem(Reparto.substring(2, 3));
            while (alIt.hasNext()) {
              try {
                JComponent comp = (JComponent) itControles.next();
                if (comp instanceof JTextField) ((JTextField) comp).setText(alIt.next().toString());
                if (comp instanceof JCheckBox) {
                  String check = ((obj = alIt.next()) != null) ? obj.toString() : "";
                  ;
                  if (check == "TRUE") {
                    ((JCheckBox) comp).setSelected(true);
                  } else {
                    ((JCheckBox) comp).setSelected(false);
                  }
                }
                if (comp instanceof JComboBox)
                  ((JComboBox) comp).setSelectedItem(alIt.next().toString());
              } catch (Exception A) {
                A.printStackTrace();
              }
            }
          }
        };
    btnBorrarConstruccion.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            btnBorrarConstruccion_actionPerformed(e);
          }
        });
    txtFechaBaja.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtFechaBaja_actionPerformed(e);
          }
        });
    txtFechaAlta.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtFechaAlta_actionPerformed(e);
          }
        });
    txtreferenciacons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtreferenciacons_actionPerformed(e);
          }
        });
    txtannoexpcons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtannoexpcons_actionPerformed(e);
          }
        });
    chkviviendacons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            chkviviendacons_actionPerformed(e);
          }
        });
    txtapreciacioncons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtapreciacioncons_actionPerformed(e);
          }
        });
    cmbtipovalorcons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cmbtipovalorcons_actionPerformed(e);
          }
        });
    cmbreparto3cons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cmbreparto3cons_actionPerformed(e);
          }
        });
    cmbreparto2cons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cmbreparto2cons_actionPerformed(e);
          }
        });
    cmbreparto1cons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cmbreparto1cons_actionPerformed(e);
          }
        });
    txtcategoriacons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtcategoriacons_actionPerformed(e);
          }
        });
    cmbusocons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cmbusocons_actionPerformed(e);
          }
        });
    txttipologiacons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txttipologiacons_actionPerformed(e);
          }
        });
    txtSuperficie_Imputable_Local.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtSuperficie_Imputable_Local_actionPerformed(e);
          }
        });
    txtSuperficie_Terrazas_Local.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtSuperficie_Terrazas_Local_actionPerformed(e);
          }
        });
    txtSuperficie_Total_Local.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtSuperficie_Total_Local_actionPerformed(e);
          }
        });
    chkIndicador_Local_Interior.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            chkIndicador_Local_Interior_actionPerformed(e);
          }
        });
    txtannoreforma.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtannoreforma_actionPerformed(e);
          }
        });
    cmbreformacons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cmbreformacons_actionPerformed(e);
          }
        });
    txtdestinocons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtdestinocons_actionPerformed(e);
          }
        });
    txtPuerta.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtPuerta_actionPerformed(e);
          }
        });
    txtPlanta.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtPlanta_actionPerformed(e);
          }
        });
    txtEscalera.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtEscalera_actionPerformed(e);
          }
        });
    txtBloque.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtBloque_actionPerformed(e);
          }
        });
    txtcargocons.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtcargocons_actionPerformed(e);
          }
        });
    padronModel.addMouseListener(mouseListener);
    padronModel.setBounds(new Rectangle(5, 5, 100, 55));
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setResizable(false);
    frame.setBounds(100, 100, 550, 400);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JButton btnNovo = new JButton("Novo");
    btnNovo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            try {
              WindowAdicionarItem window = new WindowAdicionarItem(biblioteca, admin);
              window.frame.setVisible(true);

              frame.setVisible(false);
              frame.dispose();

            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
    btnNovo.setBounds(419, 12, 117, 25);
    frame.getContentPane().add(btnNovo);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 24, 548, 353);
    frame.getContentPane().add(tabbedPane);

    JPanel panelLivro = new JPanel();
    tabbedPane.addTab("Livro", null, panelLivro, null);
    panelLivro.setLayout(null);

    DefaultListModel listAuxLivro = new DefaultListModel();
    for (Livro l : biblioteca.getlistaLivros()) {
      listAuxLivro.addElement(l.getTitulo());
    }
    final JButton btnRemoverLivro = new JButton("Remover");
    final JButton btnEditarLivro = new JButton("Editar");
    final JList listLivros = new JList(listAuxLivro);
    listLivros.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            Livro l =
                (Livro)
                    admin.pesquisarItem(
                        false,
                        listLivros.getSelectedValue().toString(),
                        biblioteca.getlistaDvds(),
                        biblioteca.getlistaLivros());
            textFieldAnoPubLivro.setText(Integer.toString(l.getAnoPublicacao()));
            textFieldEditoraLivro.setText(l.getEditora());
            textFieldTituloLivro.setText(l.getTitulo());
            textFieldCotaLivro.setText(l.getCota());
            textFieldISBNLivro.setText(l.getISBN());
            btnRemoverLivro.setEnabled(true);
            btnEditarLivro.setEnabled(true);
            String autores = new String();
            for (Autor a : l.getAutor()) {
              autores = autores.concat(a.getNome() + " ");
            }
            textFieldAutoresLivro.setText(autores);
          }
        });
    listLivros.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listLivros.setBounds(12, 12, 172, 302);
    panelLivro.add(listLivros);

    textFieldTituloLivro = new JTextField();
    textFieldTituloLivro.setEditable(false);
    textFieldTituloLivro.setBounds(369, 24, 162, 19);
    panelLivro.add(textFieldTituloLivro);
    textFieldTituloLivro.setColumns(10);

    JLabel lblTitulo = new JLabel("Titulo");
    lblTitulo.setBounds(202, 26, 70, 15);
    panelLivro.add(lblTitulo);

    btnEditarLivro.setEnabled(false);
    final JButton btnSairLivro = new JButton("Sair");
    btnRemoverLivro.setEnabled(false);

    btnEditarLivro.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (toogleEditarLivro) {
              btnEditarLivro.setText("Guardar");
              btnSairLivro.setText("Cancelar");
              btnRemoverLivro.setEnabled(false);
              textFieldAnoPubLivro.setEditable(true);
              textFieldCotaLivro.setEditable(true);
              textFieldISBNLivro.setEditable(true);
              textFieldTituloLivro.setEditable(true);
              textFieldEditoraLivro.setEditable(true);
              toogleEditarLivro = false;
              toogleSairLivro = false;
              toogleRemoverLivro = false;

            } else {
              btnEditarLivro.setText("Editar");
              btnSairLivro.setText("Sair");
              btnRemoverLivro.setEnabled(true);
              textFieldAnoPubLivro.setEditable(false);
              textFieldCotaLivro.setEditable(false);
              textFieldISBNLivro.setEditable(false);
              textFieldTituloLivro.setEditable(false);
              textFieldEditoraLivro.setEditable(false);
              toogleEditarLivro = true;
              toogleSairLivro = true;
              toogleRemoverLivro = false;

              String titulo_anterior = listLivros.getSelectedValue().toString();
              try {
                admin.removerItem(
                    false, titulo_anterior, biblioteca.getlistaDvds(), biblioteca.getlistaLivros());
                admin.adicionarItem(
                    false,
                    textFieldTituloLivro.getText(),
                    Integer.parseInt(textFieldAnoPubLivro.getText()),
                    textFieldEditoraLivro.getText(),
                    textFieldCotaLivro.getText(),
                    textFieldISBNLivro.getText(),
                    null,
                    biblioteca.getlistaDvds(),
                    biblioteca.getlistaLivros());
                biblioteca.save(4);
                frame.setVisible(false);
                frame.dispose();

                WindowSucesso window = new WindowSucesso();
                window.frame.setVisible(true);

              } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (Exception e1) {
                e1.printStackTrace();
              }
            }
          }
        });
    btnEditarLivro.setBounds(202, 289, 101, 25);
    panelLivro.add(btnEditarLivro);

    btnRemoverLivro.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            admin.removerItem(
                false,
                listLivros.getSelectedValue().toString(),
                biblioteca.getlistaDvds(),
                biblioteca.getlistaLivros());
            try {
              biblioteca.save(3);
            } catch (IOException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
            try {
              WindowSucesso window = new WindowSucesso();
              window.frame.setVisible(true);
            } catch (Exception e1) {
              e1.printStackTrace();
            }
            frame.setVisible(false);
            frame.dispose();
          }
        });
    btnRemoverLivro.setBounds(317, 289, 101, 25);
    panelLivro.add(btnRemoverLivro);

    btnSairLivro.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (toogleSairLivro) {
              frame.setVisible(false);
              frame.dispose();
            } else {
              btnEditarLivro.setText("Editar");
              btnSairLivro.setText("Sair");
              btnRemoverLivro.setEnabled(true);
              textFieldAnoPubLivro.setEditable(false);
              textFieldCotaLivro.setEditable(false);
              textFieldISBNLivro.setEditable(false);
              textFieldTituloLivro.setEditable(false);
              textFieldEditoraLivro.setEditable(false);
              toogleEditarLivro = true;
              toogleSairLivro = true;
              toogleRemoverLivro = false;
            }
          }
        });
    btnSairLivro.setBounds(430, 289, 101, 25);
    panelLivro.add(btnSairLivro);

    JLabel lblAnoPublicao = new JLabel("Ano Publicação");
    lblAnoPublicao.setBounds(202, 57, 114, 15);
    panelLivro.add(lblAnoPublicao);

    textFieldAnoPubLivro = new JTextField();
    textFieldAnoPubLivro.setEditable(false);
    textFieldAnoPubLivro.setBounds(369, 55, 162, 19);
    panelLivro.add(textFieldAnoPubLivro);
    textFieldAnoPubLivro.setColumns(10);

    JLabel lblEditora = new JLabel("Editora");
    lblEditora.setBounds(202, 88, 70, 15);
    panelLivro.add(lblEditora);

    textFieldEditoraLivro = new JTextField();
    textFieldEditoraLivro.setEditable(false);
    textFieldEditoraLivro.setBounds(369, 86, 162, 19);
    panelLivro.add(textFieldEditoraLivro);
    textFieldEditoraLivro.setColumns(10);

    textFieldISBNLivro = new JTextField();
    textFieldISBNLivro.setEditable(false);
    textFieldISBNLivro.setBounds(369, 115, 162, 19);
    panelLivro.add(textFieldISBNLivro);
    textFieldISBNLivro.setColumns(10);

    textFieldCotaLivro = new JTextField();
    textFieldCotaLivro.setEditable(false);
    textFieldCotaLivro.setBounds(369, 146, 162, 19);
    panelLivro.add(textFieldCotaLivro);
    textFieldCotaLivro.setColumns(10);

    JLabel lblAutores = new JLabel("Autores");
    lblAutores.setBounds(202, 179, 70, 15);
    panelLivro.add(lblAutores);

    JLabel lblIsbn = new JLabel("ISBN");
    lblIsbn.setBounds(202, 117, 70, 15);
    panelLivro.add(lblIsbn);

    JLabel lblCota = new JLabel("Cota");
    lblCota.setBounds(202, 148, 70, 15);
    panelLivro.add(lblCota);

    textFieldAutoresLivro = new JTextField();
    textFieldAutoresLivro.setEditable(false);
    textFieldAutoresLivro.setColumns(10);
    textFieldAutoresLivro.setBounds(369, 176, 162, 19);
    panelLivro.add(textFieldAutoresLivro);

    JPanel panelDVD = new JPanel();
    tabbedPane.addTab("DVD", null, panelDVD, null);
    panelDVD.setLayout(null);

    DefaultListModel listAuxDVD = new DefaultListModel();
    for (DVD d : biblioteca.getlistaDvds()) {
      listAuxDVD.addElement(d.getTitulo());
    }
    final JList listDVD = new JList(listAuxDVD);
    final JButton btnRemoverDVD = new JButton("Remover");
    final JButton btnEditarDVD = new JButton("Editar");
    listDVD.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            DVD d =
                (DVD)
                    admin.pesquisarItem(
                        true,
                        listDVD.getSelectedValue().toString(),
                        biblioteca.getlistaDvds(),
                        biblioteca.getlistaLivros());
            textFieldAnoPubDVD.setText(Integer.toString(d.getAnoPublicacao()));
            textFieldEditoraDVD.setText(d.getEditora());
            textFieldTituloDVD.setText(d.getTitulo());
            btnRemoverDVD.setEnabled(true);
            btnEditarDVD.setEnabled(true);
          }
        });
    listDVD.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listDVD.setBounds(12, 12, 172, 302);
    panelDVD.add(listDVD);

    textFieldTituloDVD = new JTextField();
    textFieldTituloDVD.setEditable(false);
    textFieldTituloDVD.setColumns(10);
    textFieldTituloDVD.setBounds(369, 24, 162, 19);
    panelDVD.add(textFieldTituloDVD);

    JLabel lblTituloDVD = new JLabel("Titulo");
    lblTituloDVD.setBounds(202, 26, 70, 15);
    panelDVD.add(lblTituloDVD);

    btnEditarDVD.setEnabled(false);
    final JButton btnSairDVD = new JButton("Sair");
    btnRemoverDVD.setEnabled(false);
    btnEditarDVD.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (toogleEditarDVD) {
              btnEditarDVD.setText("Guardar");
              btnSairDVD.setText("Cancelar");
              btnRemoverDVD.setEnabled(false);
              textFieldAnoPubDVD.setEditable(true);
              textFieldTituloDVD.setEditable(true);
              textFieldEditoraDVD.setEditable(true);
              toogleEditarDVD = false;
              toogleSairDVD = false;
              toogleRemoverDVD = false;
            } else {
              btnEditarDVD.setText("Editar");
              btnSairDVD.setText("Sair");
              btnRemoverDVD.setEnabled(true);
              textFieldAnoPubDVD.setEditable(false);
              textFieldTituloDVD.setEditable(false);
              textFieldEditoraDVD.setEditable(false);
              toogleEditarDVD = true;
              toogleSairDVD = true;
              toogleRemoverDVD = true;

              String titulo_anterior = listDVD.getSelectedValue().toString();
              try {
                admin.removerItem(
                    true, titulo_anterior, biblioteca.getlistaDvds(), biblioteca.getlistaLivros());
                admin.adicionarItem(
                    true,
                    textFieldTituloDVD.getText(),
                    Integer.parseInt(textFieldAnoPubDVD.getText()),
                    textFieldEditoraDVD.getText(),
                    null,
                    null,
                    null,
                    biblioteca.getlistaDvds(),
                    biblioteca.getlistaLivros());
                biblioteca.save(3);

                frame.setVisible(false);
                frame.dispose();

                WindowSucesso window = new WindowSucesso();
                window.frame.setVisible(true);

              } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (Exception e1) {
                e1.printStackTrace();
              }
            }
          }
        });
    btnEditarDVD.setBounds(202, 289, 101, 25);
    panelDVD.add(btnEditarDVD);

    btnRemoverDVD.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            admin.removerItem(
                true,
                listDVD.getSelectedValue().toString(),
                biblioteca.getlistaDvds(),
                biblioteca.getlistaLivros());
            try {
              biblioteca.save(4);
            } catch (IOException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
            try {
              WindowSucesso window = new WindowSucesso();
              window.frame.setVisible(true);
            } catch (Exception e1) {
              e1.printStackTrace();
            }
            frame.setVisible(false);
            frame.dispose();
          }
        });
    btnRemoverDVD.setBounds(317, 289, 101, 25);
    panelDVD.add(btnRemoverDVD);

    btnSairDVD.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (toogleSairDVD) {
              frame.setVisible(false);
              frame.dispose();
            } else {
              btnEditarDVD.setText("Editar");
              btnSairDVD.setText("Sair");
              btnRemoverDVD.setEnabled(true);
              textFieldAnoPubDVD.setEditable(false);
              textFieldTituloDVD.setEditable(false);
              textFieldEditoraDVD.setEditable(false);
              toogleEditarDVD = true;
              toogleSairDVD = true;
              toogleRemoverDVD = true;
            }
          }
        });
    btnSairDVD.setBounds(430, 289, 101, 25);
    panelDVD.add(btnSairDVD);

    JLabel lblAnoPubDVD = new JLabel("Ano Publicação");
    lblAnoPubDVD.setBounds(202, 57, 114, 15);
    panelDVD.add(lblAnoPubDVD);

    textFieldAnoPubDVD = new JTextField();
    textFieldAnoPubDVD.setEditable(false);
    textFieldAnoPubDVD.setColumns(10);
    textFieldAnoPubDVD.setBounds(369, 55, 162, 19);
    panelDVD.add(textFieldAnoPubDVD);

    JLabel lblEditoraDVD = new JLabel("Editora");
    lblEditoraDVD.setBounds(202, 88, 70, 15);
    panelDVD.add(lblEditoraDVD);

    textFieldEditoraDVD = new JTextField();
    textFieldEditoraDVD.setEditable(false);
    textFieldEditoraDVD.setColumns(10);
    textFieldEditoraDVD.setBounds(369, 86, 162, 19);
    panelDVD.add(textFieldEditoraDVD);
  }
Пример #11
0
  private void initGUI() {
    try {
      setPreferredSize(new Dimension(690, 225));
      this.setLayout(null);
      {
        eraseLabel = new JLabel();
        this.add(eraseLabel);
        eraseLabel.setName("eraseLabel");
        eraseLabel.setBounds(184, 35, 59, 15);
      }
      {
        addButton = new JButton();
        this.add(addButton);
        addButton.setBounds(465, 34, 16, 18);
        addButton.setAction(getAppActionMap().get("add"));
        addButton.setFocusable(false);
        addButton.addMouseListener(
            new MouseAdapter() {
              public void mouseClicked(MouseEvent evt) {
                addButtonMouseClicked(evt);
              }
            });
      }
      {
        doneButton = new JButton();
        this.add(doneButton);
        doneButton.setBounds(315, 181, 77, 29);
        doneButton.setName("doneButton");
        doneButton.addMouseListener(
            new MouseAdapter() {
              public void mouseClicked(MouseEvent evt) {
                doneButtonMouseClicked(evt);
              }
            });
      }
      {
        jScrollPane1 = new JScrollPane();
        this.add(jScrollPane1);
        jScrollPane1.setBounds(255, 66, 192, 103);
        {
          nodesetModel = new DefaultListModel();
          nodesetList = new JList();
          jScrollPane1.setViewportView(nodesetList);
          nodesetList.setModel(nodesetModel);
          nodesetList.setBounds(410, 75, 187, 100);
        }
      }
      {
        infoButton = new JButton();
        this.add(infoButton);
        infoButton.setBounds(668, 196, 16, 18);
        infoButton.setAction(getAppActionMap().get("info"));
        infoButton.setFocusable(false);
        infoButton.setFocusPainted(false);
        infoButton.setBorderPainted(false);
        infoButton.setContentAreaFilled(false);
        infoButton.setMargin(new Insets(0, 0, 0, 0));
        infoButton.setToolTipText("info");
      }
      {
        nodesetLabel = new JLabel();
        this.add(nodesetLabel);
        nodesetLabel.setBounds(255, 12, 80, 15);
        nodesetLabel.setName("nodesetLabel");
      }
      {
        DefaultComboBoxModel nodesetComboBoxModel = new DefaultComboBoxModel();

        String str = "";
        Hashtable<String, Node> nodes = network.getNodes();
        Set<String> set = nodes.keySet();

        Iterator<String> itr = set.iterator();
        while (itr.hasNext()) {
          str = itr.next();
          nodesetComboBoxModel.addElement(nodes.get(str).getIdentifier());
        }
        nodesetComboBox = new JComboBox();
        this.add(nodesetComboBox);
        nodesetComboBox.setModel(nodesetComboBoxModel);
        nodesetComboBox.setBounds(255, 31, 193, 22);
      }
      Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this);
    } catch (Exception e) {
    }
  }
Пример #12
0
  /** Create the frame. */
  public GestorAsignaturasUI() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JList lstAsignaturas = new JList();
    lstAsignaturas.setModel(ga.getAsignatura());
    lstAsignaturas.setBounds(40, 23, 350, 183);
    contentPane.add(lstAsignaturas);

    JButton btnEliminar = new JButton("Eliminar");
    btnEliminar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            int ind = lstAsignaturas.getSelectedIndex();
            if (ind >= 0) {
              ga.delAsignatura(ind);
            }
          }
        });
    btnEliminar.setBounds(26, 217, 89, 23);
    contentPane.add(btnEliminar);

    JButton btnEditar = new JButton("Editar");
    btnEditar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int ind = lstAsignaturas.getSelectedIndex();
            if (ind >= 0) {
              AsignaturaUI frmAsig = new AsignaturaUI(ga);
              frmAsig.setIndAsig(ind);
              frmAsig.setVisible(true);
            }
          }
        });
    btnEditar.setBounds(125, 217, 89, 23);
    contentPane.add(btnEditar);

    JButton btnNuevo = new JButton("Nuevo");
    btnNuevo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            AsignaturaUI frmAsig = new AsignaturaUI(ga);
            frmAsig.setVisible(true);
          }
        });
    btnNuevo.setBounds(224, 217, 89, 23);
    contentPane.add(btnNuevo);

    JButton btnSalir = new JButton("Salir");
    btnSalir.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });
    btnSalir.setBounds(323, 217, 89, 23);
    contentPane.add(btnSalir);

    JLabel lblAsignaturas = new JLabel("Asignaturas");
    lblAsignaturas.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblAsignaturas.setBounds(180, -2, 89, 23);
    contentPane.add(lblAsignaturas);
  }
  public InterfaceScreen() {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      e.printStackTrace();
    }
    setLayout(null);
    setSize(Main.WIDTH - (Main.WIDTH - 350), Main.HEIGHT);
    int panelWidth = getWidth();
    // int panelHeight = getHeight();

    // Options
    Border defaultBorder = BorderFactory.createLineBorder(new Color(0, 75, 0), 3, true);

    String[] options = {"Change Size", "Change Tile", "Change Tool"};
    optionsList = new JList<String>(options);
    DefaultListCellRenderer renderer = (DefaultListCellRenderer) optionsList.getCellRenderer();
    renderer.setHorizontalAlignment(SwingConstants.CENTER);
    optionsList.setBorder(defaultBorder);
    optionsList.setBounds(10, 11, panelWidth - 20, 100);
    optionsList.addListSelectionListener(
        new ListSelectionListener() {;
          public void valueChanged(ListSelectionEvent e) {
            if (optionsList.getSelectedIndex() == 0) {
              String w1 = JOptionPane.showInputDialog("Enter the width - ");
              if (w1 != null) {
                String h1 = JOptionPane.showInputDialog("Enter the height - ");
                if (h1 != null) {
                  int width = Integer.parseInt(w1);
                  int height = Integer.parseInt(h1);

                  int w = GameScreen.getLevel().width;
                  int h = GameScreen.getLevel().height;
                  GameScreen.getLevel().width = width * 32;
                  GameScreen.getLevel().height = height * 32;
                  GameScreen.undo.add(
                      new UndoEvent() {
                        public void undo() {
                          GameScreen.getLevel().width = w;
                          GameScreen.getLevel().height = h;
                        }
                      });
                }
              }
            } else if (optionsList.getSelectedIndex() == 1) {
              Object[] tiles = {"Grass", "Player Spawn", "Water", "Desert", "Stone"};
              String s =
                  (String)
                      JOptionPane.showInputDialog(
                          null, "Tiles", "Input", JOptionPane.PLAIN_MESSAGE, null, tiles, "Tile");
              if (s != null && !s.equals("Tile")) {
                switch (s) {
                  case "Grass":
                    GameScreen.getLevel().getBrush().setBrushType(TileConstants.ID_GRASS);
                    break;
                  case "Player Spawn":
                    GameScreen.getLevel().getBrush().setBrushType(TileConstants.ID_PLAYER_SPAWN);
                    break;
                  case "Water":
                    GameScreen.getLevel().getBrush().setBrushType(TileConstants.ID_WATER);
                    break;
                  case "Desert":
                    GameScreen.getLevel().getBrush().setBrushType(TileConstants.ID_DESERT);
                    break;
                  case "Stone":
                    GameScreen.getLevel().getBrush().setBrushType(TileConstants.ID_STONE);
                    break;
                }
              }
            } else if (optionsList.getSelectedIndex() == 2) {
              Object[] tools = {"Pencil", "Rectangle"};
              String tool =
                  (String)
                      JOptionPane.showInputDialog(
                          null, "Tools", "Input", JOptionPane.PLAIN_MESSAGE, null, tools, "Tool");
              if (tool != null) {
                switch (tool) {
                  case "Pencil":
                    GameScreen.getLevel().getBrush().setToolType(BrushConstants.BRUSH_PENCIL);
                    break;
                  case "Rectangle":
                    GameScreen.getLevel().getBrush().setToolType(BrushConstants.BRUSH_FLOOD);
                    break;
                }
              }
            }
            optionsList.clearSelection();
            Main.getGameScreen().requestFocus();
          }
        });

    saveButton = new JButton("Save");
    saveButton.setBounds(10, 115, panelWidth - 20, 30);
    saveButton.setBorder(defaultBorder);
    saveButton.setBackground(Color.WHITE);
    saveButton.setContentAreaFilled(false);
    saveButton.setOpaque(true);
    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GameScreen.getLevel().save();
          }
        });

    loadButton = new JButton("Load");
    loadButton.setBounds(10, 149, panelWidth - 20, 30);
    loadButton.setBorder(defaultBorder);
    loadButton.setBackground(Color.WHITE);
    loadButton.setContentAreaFilled(false);
    loadButton.setOpaque(true);
    loadButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GameScreen.getLevel().load();
          }
        });

    add(optionsList);
    add(saveButton);
    add(loadButton);
  }
Пример #14
0
  public ChooseForm() {

    this.TITLE = MainForm.TITLE;

    curForm = this;

    cPanel = new JPanel();
    cPanel.setLayout(null);

    this.setTitle(TITLE + " - Choose files to rename");
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    this.setSize(640, 480);
    this.setResizable(false);
    this.setModalityType(DEFAULT_MODALITY_TYPE);
    this.setLocationRelativeTo(null);

    // Fulfilling read of the directory tree
    try {
      DirectoryHandle.cleanArrays();
      FileListingVisitor.runFileListingVisitor(DirectoryHandle.getPath().toString());
      arrayList = new String[DirectoryHandle.getFilesNumber() + 1];
      modelList = new DefaultListModel<>();
      pathList = new DefaultListModel<>();
    } catch (IOException e1) {
      JOptionPane.showMessageDialog(
          null,
          "Failed to get files list! Program will be closed!",
          TITLE,
          JOptionPane.PLAIN_MESSAGE);
      System.exit(0);
    }

    // Filling lists using data of file
    for (int i = 0; i <= DirectoryHandle.getFilesNumber(); i++) {

      if (DirectoryHandle.getFileName(i).toString().toLowerCase().endsWith(".jpg")
          && MainForm.isJPG) {
        arrayList[k] = DirectoryHandle.getFileName(i).toString();
        modelList.add(k, DirectoryHandle.getFileName(i).getFileName().toString());
        pathList.add(k, DirectoryHandle.getFileName(i).getParent().toString());
        k++;
      }

      if (DirectoryHandle.getFileName(i).toString().toLowerCase().endsWith(".png")
          && MainForm.isPNG) {
        arrayList[k] = DirectoryHandle.getFileName(i).toString();
        modelList.add(k, DirectoryHandle.getFileName(i).getFileName().toString());
        pathList.add(k, DirectoryHandle.getFileName(i).getParent().toString());
        k++;
      }

      if (DirectoryHandle.getFileName(i).toString().toLowerCase().endsWith(".bmp")
          && MainForm.isBMP) {
        arrayList[k] = DirectoryHandle.getFileName(i).toString();
        modelList.add(k, DirectoryHandle.getFileName(i).getFileName().toString());
        pathList.add(k, DirectoryHandle.getFileName(i).getParent().toString());
        k++;
      }
    }

    // Left list
    leftList = new JList<>(modelList);
    leftList.setVisibleRowCount(VISIBLE_ROW_COUNT);
    leftList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    leftList.setBounds(15, 25, 265, 350);
    leftList.setEnabled(true);
    cPanel.add(leftList);

    leftScrollPane = new JScrollPane(leftList);
    leftScrollPane.setBounds(15, 25, 265, 350);
    cPanel.add(leftScrollPane);

    leftLabel = new JLabel("Files list:");
    leftLabel.setBounds(20, 0, 260, 32);
    leftLabel.setEnabled(true);
    cPanel.add(leftLabel);

    // Transfer buttons
    toLeftButton = new JButton(">");
    toLeftButton.setBounds(290, 120, 65, 32);
    toLeftButton.setEnabled(true);
    cPanel.add(toLeftButton);

    allLeftButton = new JButton(">>>");
    allLeftButton.setBounds(290, 160, 65, 32);
    allLeftButton.setEnabled(true);
    cPanel.add(allLeftButton);

    toRightButton = new JButton("<");
    toRightButton.setBounds(290, 200, 65, 32);
    toRightButton.setEnabled(true);
    cPanel.add(toRightButton);

    allRightButton = new JButton("<<<");
    allRightButton.setBounds(290, 240, 65, 32);
    allRightButton.setEnabled(true);
    cPanel.add(allRightButton);

    // Right list
    rightLabel = new JLabel("Will be renamed:");
    rightLabel.setBounds(370, 0, 260, 32);
    rightLabel.setEnabled(true);
    cPanel.add(rightLabel);

    rightList = new JList<>(new DefaultListModel<String>());
    rightList.setVisibleRowCount(VISIBLE_ROW_COUNT);
    rightList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    rightList.setBounds(365, 25, 265, 350);
    rightList.setEnabled(true);
    cPanel.add(rightList);

    rightScrollPane = new JScrollPane(rightList);
    rightScrollPane.setBounds(365, 25, 265, 350);
    cPanel.add(rightScrollPane);

    // Control buttons
    cancelButton = new JButton("Cancel");
    cancelButton.setBounds(440, 395, 85, 32);
    cancelButton.setEnabled(true);
    cPanel.add(cancelButton);

    okButton = new JButton("Ok");
    okButton.setBounds(535, 395, 85, 32);
    okButton.setEnabled(false);
    cPanel.add(okButton);

    // Handling actions of controls.
    toLeftButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            List<String> selected = leftList.getSelectedValuesList();
            DefaultListModel<String> left = (DefaultListModel<String>) leftList.getModel();
            DefaultListModel<String> right = (DefaultListModel<String>) rightList.getModel();
            for (String item : selected) {
              left.removeElement(item);
              right.addElement(item);
            }

            setOkButtonEnabled(right);
          }
        });

    allLeftButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            DefaultListModel<String> left = (DefaultListModel<String>) leftList.getModel();
            DefaultListModel<String> right = (DefaultListModel<String>) rightList.getModel();
            for (Object item : left.toArray()) {
              right.addElement((String) item);
            }
            left.removeAllElements();

            setOkButtonEnabled(right);
          }
        });

    toRightButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            List<String> selected = rightList.getSelectedValuesList();
            DefaultListModel<String> left = (DefaultListModel<String>) leftList.getModel();
            DefaultListModel<String> right = (DefaultListModel<String>) rightList.getModel();
            for (String item : selected) {
              right.removeElement(item);
              left.addElement(item);
            }

            setOkButtonEnabled(right);
          }
        });

    allRightButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            DefaultListModel<String> left = (DefaultListModel<String>) leftList.getModel();
            DefaultListModel<String> right = (DefaultListModel<String>) rightList.getModel();
            for (Object item : right.toArray()) {
              left.addElement((String) item);
            }
            right.removeAllElements();

            setOkButtonEnabled(right);
          }
        });

    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent even) {
            dispose();
          }
        });

    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            RenameFiles rf = new RenameFiles(curForm);
            rf.runRenameFiles();
            dispose();
          }
        });

    getContentPane().add(cPanel);
  }
Пример #15
0
  public Image_Upload() {

    setBounds(0, 0, 1020, 665);
    setLayout(new MigLayout("", "[996px,grow]", "[300px,grow][326px]"));

    ms_connect = new Ms_Connect();

    JPanel panel = new JPanel();
    panel.setBorder(new LineBorder(new Color(0, 0, 0)));
    add(panel, "cell 0 0,grow");
    panel.setLayout(
        new MigLayout(
            "",
            "[200px,grow][99px][278px][12px][97px,grow][97px][89px][64px]",
            "[23px][158px][10px][31px][10px][45px,grow]"));

    text_path = new JTextField();
    panel.add(text_path, "cell 0 0,growx,aligny center");
    text_path.setColumns(10);
    text_path.setText("C:\\");

    JButton btn_path = new JButton("< \uD3F4\uB354\uC120\uD0DD");
    panel.add(btn_path, "cell 1 0,growx,aligny top");
    btn_path.addActionListener(this);

    JButton btn_upload = new JButton("\uC5C5\uB85C\uB4DC >>");
    panel.add(btn_upload, "cell 1 5,grow");
    btn_upload.addActionListener(this);

    dlm = new DefaultListModel<String>();

    list_image = new JList<String>();
    list_image.setBounds(0, 0, 274, 254);
    // panel.add(list_image);
    list_image.setModel(dlm);

    JScrollPane jsp = new JScrollPane();
    jsp.setViewportView(list_image);

    panel.add(jsp, "cell 0 1 1 5,grow");

    JLabel lblFtp = new JLabel("\uB2E8\uB3C5\uD3F4\uB354 FTP \uC774\uBBF8\uC9C0");
    lblFtp.setFont(new Font("굴림", Font.PLAIN, 13));
    lblFtp.setHorizontalAlignment(SwingConstants.CENTER);
    panel.add(lblFtp, "cell 2 0,growx,aligny center");

    JScrollPane scrollPane = new JScrollPane();
    panel.add(scrollPane, "cell 2 1 3 5,grow");

    DefaultTableCellRenderer celAlignCenter = new DefaultTableCellRenderer();
    celAlignCenter.setHorizontalAlignment(JLabel.CENTER);

    DefaultTableCellRenderer celAlignRight = new DefaultTableCellRenderer();
    celAlignRight.setHorizontalAlignment(JLabel.RIGHT);

    String[] head = {"순번", "파일명(바코드)", "확장자", "비고"};
    dtm = new DefaultTableModel();
    dtm.setColumnIdentifiers(head);

    table_ftp_view = new JTable();
    table_ftp_view.setModel(dtm);

    // 헤더의 컬럼의 라벨을 내가 직접제어할 수있도록, 자동생성하는 것을 금지한다.
    table_ftp_view.setAutoCreateColumnsFromModel(false);

    // 테이블의 선택모드를 설정한다
    table_ftp_view.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(table_ftp_view);

    // 스크롤페인에 배경색을 흰색으로 변경한다.
    scrollPane.getViewport().setBackground(Color.WHITE);

    // 자동정렬 기능을 사용한다.
    table_ftp_view.setAutoCreateRowSorter(true);

    // 자동정렬 기능을 첨가한다.
    table_ftp_view.setRowSorter(new TableRowSorter<TableModel>(dtm));

    table_ftp_view.getTableHeader().setReorderingAllowed(false); // 이동불가
    table_ftp_view.getTableHeader().getColumnModel().getColumn(0).setCellRenderer(celAlignCenter);

    table_ftp_view.getColumn("순번").setPreferredWidth(40);
    table_ftp_view.getColumn("순번").setCellRenderer(celAlignCenter);

    table_ftp_view.getColumn("파일명(바코드)").setPreferredWidth(80);

    table_ftp_view.getColumn("확장자").setPreferredWidth(40);

    table_ftp_view.getColumn("비고").setPreferredWidth(100);

    table_ftp_view.addMouseListener(
        new MouseListener() {

          @Override
          public void mouseReleased(MouseEvent e) {
            // TODO Auto-generated method stub

          }

          @Override
          public void mousePressed(MouseEvent e) {
            // TODO Auto-generated method stub

          }

          @Override
          public void mouseExited(MouseEvent e) {
            // TODO Auto-generated method stub

          }

          @Override
          public void mouseEntered(MouseEvent e) {
            // TODO Auto-generated method stub

          }

          @Override
          public void mouseClicked(MouseEvent e) {
            // TODO Auto-generated method stub
            if (e.getButton() == 1) {
              System.out.println("마우스 클릭 됐습니다.");
              // 이미지를 불러옵니다.
              image_Show();
            }
          }
        });

    JButton btn_ftpview = new JButton("\uAC80\uC0C9");
    panel.add(btn_ftpview, "cell 4 0,growx,aligny top");
    btn_ftpview.setActionCommand("검색");
    btn_ftpview.addActionListener(this);

    label_show_image = new JLabel();
    label_show_image.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    // label_show_image.setBounds(0, 0, 250, 250);
    panel.add(label_show_image, "cell 5 1 3 5,grow");

    JButton btn_delete = new JButton("\uC0AD\uC81C");
    btn_delete.addActionListener(this);
    panel.add(btn_delete, "cell 7 0,growx,aligny top");

    JButton btn_download = new JButton("\uB2E4\uC6B4\uB85C\uB4DC");
    btn_download.addActionListener(this);
    panel.add(btn_download, "cell 5 0,growx,aligny top");

    JButton btn_all_select = new JButton("< \uC804\uCCB4\uC120\uD0DD");
    btn_all_select.addActionListener(this);
    panel.add(btn_all_select, "cell 1 3,grow");

    JButton btn_select_delete = new JButton("< \uC120\uD0DD\uC0AD\uC81C");
    btn_select_delete.addActionListener(this);
    panel.add(btn_select_delete, "cell 1 1,growx,aligny bottom");

    JPanel panel_1 = new JPanel();
    panel_1.setBorder(new LineBorder(new Color(0, 0, 0)));
    add(panel_1, "cell 0 1,grow");
    panel_1.setLayout(new MigLayout("", "[]", "[]"));
  }
Пример #16
0
 private void updateLocations() {
   groupsList.setBounds(
       LABEL_SPACE, 0, groupsList.getPreferredSize().width, groupsList.getPreferredSize().height);
   slider.setBounds(LABEL_SPACE + groupsList.getWidth(), 0, slider.getWidth(), slider.getHeight());
 }
  public Lightbox() {
    setResizable(false);
    setIconImage(
        Toolkit.getDefaultToolkit().getImage(Lightbox.class.getResource("/imagens/anICO.png")));
    setTitle("Android Noob Gerador Lightbox");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 1000, 559);
    this.setLocation(
        ((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - (this.getWidth() / 2)),
        ((Toolkit.getDefaultToolkit().getScreenSize().height / 2) - (this.getHeight() / 2)));
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    urlImagemLightboxTexto = new JTextField();
    urlImagemLightboxTexto.setBounds(103, 87, 634, 20);
    contentPane.add(urlImagemLightboxTexto);
    urlImagemLightboxTexto.setColumns(10);

    codigoGeradoLightbox = new JTextArea();
    codigoGeradoLightbox.setEditable(false);
    codigoGeradoLightbox.setLineWrap(true);
    codigoGeradoLightbox.setBounds(10, 295, 727, 182);
    contentPane.add(codigoGeradoLightbox);

    JLabel lblUrlDaImagem = new JLabel("Url da imagem:");
    lblUrlDaImagem.setBounds(10, 90, 79, 14);
    contentPane.add(lblUrlDaImagem);

    JLabel lblTituloDaImagem = new JLabel("Title:");
    lblTituloDaImagem.setBounds(10, 115, 79, 14);
    contentPane.add(lblTituloDaImagem);

    JLabel lblAlt = new JLabel("Alt:");
    lblAlt.setBounds(10, 140, 79, 14);
    contentPane.add(lblAlt);

    titleImagemLightboxTexto = new JTextField();
    titleImagemLightboxTexto.setBounds(103, 118, 634, 20);
    contentPane.add(titleImagemLightboxTexto);
    titleImagemLightboxTexto.setColumns(10);

    altImagemLightboxTexto = new JTextField();
    altImagemLightboxTexto.setBounds(103, 146, 634, 20);
    contentPane.add(altImagemLightboxTexto);
    altImagemLightboxTexto.setColumns(10);

    lblparaAdicionarMais =
        new JLabel(
            "<html><b><font color='red'>*</font></b> Para adicionar mais de uma imagem, altere os campos com os valores da pr\u00F3xima imagem e clique em gerar novamente</html>");
    lblparaAdicionarMais.setToolTipText("");
    lblparaAdicionarMais.setBounds(19, 261, 718, 23);
    contentPane.add(lblparaAdicionarMais);

    nImagens = new JLabel("0");
    nImagens.setBounds(146, 236, 46, 14);
    contentPane.add(nImagens);

    lblNewLabel = new JLabel("Imagens Adicionadas:");
    lblNewLabel.setBounds(10, 236, 126, 14);
    contentPane.add(lblNewLabel);

    limpaCodigoLightbox = new JButton("Limpar C\u00F3digo");
    limpaCodigoLightbox.setEnabled(false);
    limpaCodigoLightbox.setBounds(10, 488, 126, 23);
    contentPane.add(limpaCodigoLightbox);
    limpaCodigoLightbox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            limpaCodigoLightboxActionPerformed(evt);
          }
        });
    copiaCodigoLightbox = new JButton("Copiar C\u00F3digo");
    copiaCodigoLightbox.setEnabled(false);
    copiaCodigoLightbox.setFont(new Font("Tahoma", Font.PLAIN, 18));
    copiaCodigoLightbox.setBounds(475, 488, 262, 39);
    contentPane.add(copiaCodigoLightbox);
    copiaCodigoLightbox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            copiaCodigoLightboxActionPerformed(evt);
          }
        });
    geraCodigoLightbox = new JButton("Gerar C\u00F3digo");
    geraCodigoLightbox.setFont(new Font("Tahoma", Font.PLAIN, 30));
    geraCodigoLightbox.setBounds(103, 177, 634, 48);
    contentPane.add(geraCodigoLightbox);

    JButton voltarInicioButton = new JButton("Voltar");
    voltarInicioButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            JFrame Inicio = new Inicio();
            Inicio.setVisible(true);
            dispose();
          }
        });
    voltarInicioButton.setBounds(895, 11, 89, 23);
    contentPane.add(voltarInicioButton);

    listaImagens = new JList();
    listaImagens.setBounds(762, 89, 222, 388);
    listaImagens.setModel(lista);
    contentPane.add(listaImagens);

    btnNewButton = new JButton("teste");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            System.out.println(((Imagens) listaImagens.getModel().getElementAt(0)).getAlt());
          }
        });
    btnNewButton.setBounds(35, 35, 89, 23);
    contentPane.add(btnNewButton);

    deletarLinkLightbox = new JButton("Deletar link");
    deletarLinkLightbox.setEnabled(false);
    deletarLinkLightbox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (listaImagens.getSelectedIndex() == -1) {
              JOptionPane.showMessageDialog(
                  null,
                  "Não foi selecionado nenhum item a ser excluído!",
                  "zero itens selecionado",
                  JOptionPane.ERROR_MESSAGE);

            } else {

              int var =
                  JOptionPane.showConfirmDialog(
                      null,
                      "Deseja realmente excluir este link ?",
                      "Excluir link ?",
                      JOptionPane.OK_CANCEL_OPTION,
                      JOptionPane.WARNING_MESSAGE);
              if (var == 0) {
                imagensLightbox.remove(listaImagens.getSelectedIndex());
                lista.remove(listaImagens.getSelectedIndex());
                int numeroImagens = imagensLightbox.size();
                int numeroImagensBotao = numeroImagens + 1;
                nImagens.setText("" + numeroImagens);
                geraCodigoLightbox.setText("Gerar Código da imagem " + numeroImagensBotao);
                codigoGeradoLightbox.setText("<div align='center'>");
                for (int ilol = 0; ilol < imagensLightbox.size(); ilol++) {
                  codigoGeradoLightbox.setText(
                      codigoGeradoLightbox.getText() + imagensLightbox.get(ilol).toStringCodigo());
                }
                codigoGeradoLightbox.setText(codigoGeradoLightbox.getText());
              }
              if (lista.getSize() == 0) {
                editarLinkLightbox.setEnabled(false);
                deletarLinkLightbox.setEnabled(false);
                limpaCodigoLightbox.setEnabled(false);
                copiaCodigoLightbox.setEnabled(false);
              } else {
                editarLinkLightbox.setEnabled(true);
                deletarLinkLightbox.setEnabled(true);
                limpaCodigoLightbox.setEnabled(true);
                copiaCodigoLightbox.setEnabled(true);
              }
            }
          }
        });
    deletarLinkLightbox.setBounds(762, 488, 89, 23);
    contentPane.add(deletarLinkLightbox);

    JLabel lblNewLabel_1 = new JLabel("New label");
    lblNewLabel_1.setIcon(new ImageIcon(Lightbox.class.getResource("/imagens/logo.png")));
    lblNewLabel_1.setBounds(232, 11, 429, 70);
    contentPane.add(lblNewLabel_1);

    editarLinkLightbox = new JButton("Editar");
    editarLinkLightbox.setEnabled(false);
    editarLinkLightbox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (listaImagens.getSelectedIndex() == -1) {
              JOptionPane.showMessageDialog(
                  null,
                  "Não foi selecionado nenhum item a ser editado!",
                  "zero itens selecionado",
                  JOptionPane.ERROR_MESSAGE);

            } else {
              JFrame LightboxEditarLink = new LightboxEditarLink();
              LightboxEditarLink.setVisible(true);
            }
          }
        });
    editarLinkLightbox.setBounds(895, 488, 89, 23);
    contentPane.add(editarLinkLightbox);

    geraCodigoLightbox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            geraCodigoLightboxActionPerformed(evt);
          }
        });

    urlImagemLightboxTexto
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              @Override
              public void changedUpdate(DocumentEvent e) {}

              @Override
              public void insertUpdate(DocumentEvent e) {
                urlLightboxFuncao();
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                urlLightboxFuncao();
              }
            });
    if (lista.getSize() > 0 && imagensLightbox.size() > 0) {
      codigoGeradoLightbox.setText("<div align='center'>");
      for (int ilol = 0; ilol < imagensLightbox.size(); ilol++) {
        codigoGeradoLightbox.setText(
            codigoGeradoLightbox.getText() + imagensLightbox.get(ilol).toStringCodigo());
      }
      codigoGeradoLightbox.setText(
          codigoGeradoLightbox.getText()
              + "\r\n<span style='font-size: x-small;''>(clique na miniatura da imagem para expandir/ampliar a imagem)</span></div><br/>");
      editarLinkLightbox.setEnabled(true);
      deletarLinkLightbox.setEnabled(true);
      limpaCodigoLightbox.setEnabled(true);
      copiaCodigoLightbox.setEnabled(true);
    }
  }
Пример #18
0
  Intern_Chat() {

    frame = new JFrame("Guide ME");
    frame.setSize(480, 550);
    frame.setResizable(false);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setBackground(new Color(211, 211, 211));
    frame.getContentPane().setLayout(null);

    // getContentPane().addMouseListener(new action2());
    JLabel lblGuideMe = new JLabel("Guide ME");
    lblGuideMe.setFont(new Font("Tahoma", Font.BOLD, 16));
    lblGuideMe.setBounds(10, 11, 85, 21);
    frame.getContentPane().add(lblGuideMe);

    textField = new JTextField();
    textField.setBounds(105, 11, 135, 21);
    frame.getContentPane().add(textField);
    textField.setColumns(10);

    ImageIcon search = new ImageIcon("list.PNG");
    btnNewButton = new JButton(search);
    btnNewButton.addActionListener(new Intern_Chat_action());
    btnNewButton.setBackground(new Color(255, 255, 255));
    btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 11));
    btnNewButton.setBounds(240, 11, 20, 21);
    frame.getContentPane().add(btnNewButton);

    btnNewButton_1 = new JButton("Home");
    btnNewButton_1.addActionListener(new Intern_Chat_action());
    btnNewButton_1.setForeground(new Color(0, 0, 0));
    btnNewButton_1.setBackground(new Color(65, 105, 225));
    btnNewButton_1.setBounds(265, 12, 78, 21);
    frame.getContentPane().add(btnNewButton_1);

    ImageIcon list = new ImageIcon("Capture.PNG");
    btnNewButton_2 = new JButton(list);
    btnNewButton_2.setBounds(350, 11, 22, 23);
    btnNewButton_2.setForeground(new Color(0, 0, 0));
    btnNewButton_2.setBackground(new Color(65, 105, 225));
    frame.getContentPane().add(btnNewButton_2);
    btnNewButton_2.addActionListener(new Intern_Chat_action());

    btnNewButton_3 = new JButton(list);
    btnNewButton_3.addActionListener(new Intern_Chat_action());
    btnNewButton_3.setBounds(380, 11, 22, 23);
    frame.getContentPane().add(btnNewButton_3);

    String content[] = {
      "Friends",
      "Places",
      "Brands",
      "Notifications",
      "Tastes",
      "Rates",
      "Message",
      "settings",
      "Log out"
    };

    // for view frinds and palces and brands
    lists = new JList(content);
    lists.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lists.setBackground(new Color(65, 105, 225));
    frame.getContentPane().add(lists);
    lists.setBounds(295, 35, 74, 171);
    lists.hide();

    String content2[] = {
      "Chick In",
      "Add Friend",
      "Add Place",
      "Add Brand",
      "Give Rate",
      "Remove Friend",
      "Remove Brand",
      "Remove Place",
      "chat"
    };
    lists1 = new JList(content2);
    lists1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lists1.setBackground(new Color(65, 105, 225));
    frame.getContentPane().add(lists1);
    lists1.setBounds(379, 35, 95, 171);
    lists1.hide();

    lists.addListSelectionListener(new Intern_Chat_action());
    lists1.addListSelectionListener(new Intern_Chat_action());

    JPanel panel_1 = new JPanel();
    panel_1.setBackground(new Color(0, 191, 255));
    panel_1.setBounds(0, 0, 560, 50);
    frame.getContentPane().add(panel_1);

    panel = new JPanel();
    panel.setBounds(0, 101, 185, 418);
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    JScrollPane scr1 = new JScrollPane(panel);
    scr1.setBounds(0, 101, 185, 418);
    JLabel Users[] = new JLabel[20];
    JLabel message[] = new JLabel[20];
    for (int i = 0; i < 20; i++) {
      if (i % 2 == 0) {
        Users[i] = new JLabel("12:52 : alaa");
        message[i] = new JLabel("how are you bitch ?");
      } else {
        Users[i] = new JLabel("12:52: You");
        message[i] = new JLabel("f**k you");
      }
      panel.add(Users[i]);
      panel.add(message[i]);
    }
    frame.getContentPane().add(scr1);

    lblChat = new JLabel("Chat");
    lblChat.setFont(new Font("Tahoma", Font.BOLD, 14));
    lblChat.setBounds(23, 61, 72, 29);
    frame.getContentPane().add(lblChat);

    textArea = new JTextArea();
    textArea.setBounds(230, 120, 173, 69);
    JScrollPane scr = new JScrollPane(textArea);
    scr.setBounds(230, 120, 173, 69);
    frame.getContentPane().add(scr);

    JButton btnSend = new JButton("Send");
    btnSend.setFont(new Font("Tahoma", Font.BOLD, 14));
    btnSend.setBounds(264, 197, 78, 23);
    frame.getContentPane().add(btnSend);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel panel = new JPanel();
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    panel.setLayout(null);

    JList list = new JList();
    list.setBorder(new LineBorder(new Color(0, 0, 0)));
    list.setModel(
        new AbstractListModel() {
          String[] values = new String[] {"Ejemplo1", "Ejemplo2", "Ejemplo3"};

          public int getSize() {
            return values.length;
          }

          public Object getElementAt(int index) {
            return values[index];
          }
        });
    list.setBounds(10, 49, 200, 173);
    panel.add(list);

    JLabel lblProductos = new JLabel("Productos");
    lblProductos.setBounds(10, 11, 200, 50);
    panel.add(lblProductos);

    JLabel lblFechaCaducidad = new JLabel("Fecha caducidad: ");
    lblFechaCaducidad.setBounds(220, 49, 105, 30);
    panel.add(lblFechaCaducidad);

    JLabel Fecha = new JLabel("04/06/14");
    Fecha.setBounds(335, 39, 200, 50);
    panel.add(Fecha);

    JLabel lblvalido = new JLabel("¿Valido?");
    lblvalido.setBounds(230, 91, 66, 50);
    panel.add(lblvalido);

    ;

    JButton btnNewButton = new JButton("Validar");

    btnNewButton.setBounds(275, 171, 89, 23);
    panel.add(btnNewButton);

    final JRadioButton rdbtnSi = new JRadioButton("Si");
    rdbtnSi.setSelected(true);

    rdbtnSi.setBounds(302, 105, 57, 23);
    panel.add(rdbtnSi);

    final JRadioButton rdbtnNo = new JRadioButton("No");
    rdbtnNo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            rdbtnSi.setSelected(false);
          }
        });
    rdbtnNo.setBounds(364, 105, 109, 23);
    panel.add(rdbtnNo);
    rdbtnSi.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            rdbtnNo.setSelected(false);
          }
        });
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (rdbtnNo.isSelected()) {
              Alert alerta = new Alert();
              alerta.mostrar();
            }
          }
        });
  }
Пример #20
0
  private void init_Components() {
    setTitle("Accountverwaltung");
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 319, 448);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    tabbedPane = new JTabbedPane(SwingConstants.TOP);
    lAccount = new JList<String>(Acclist);
    tabbedPane.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent arg0) {}
        });
    tabbedPane.setBounds(5, 5, 301, 382);
    contentPane.add(tabbedPane);

    pAccAusw = new JPanel();
    tabbedPane.addTab("Accountauswahl", null, pAccAusw, null);
    pAccAusw.setLayout(null);

    lblAccName = new JLabel("");
    lblAccName.setBounds(131, 38, 127, 14);
    pAccAusw.add(lblAccName);

    lblAccEmail = new JLabel("");
    lblAccEmail.setBounds(131, 88, 127, 14);
    pAccAusw.add(lblAccEmail);

    lblAccCountChar = new JLabel("");
    lblAccCountChar.setBounds(131, 138, 127, 14);
    pAccAusw.add(lblAccCountChar);

    lAccount = new JList<String>(Acclist);
    lAccount.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {}
        });
    lAccount.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lAccount.setBounds(10, 12, 111, 334);
    pAccAusw.add(lAccount);

    lblAccWName = new JLabel("Name");
    lblAccWName.setBounds(131, 13, 35, 14);
    pAccAusw.add(lblAccWName);

    lblAccWEmail = new JLabel("Email");
    lblAccWEmail.setBounds(131, 63, 35, 14);
    pAccAusw.add(lblAccWEmail);

    lblAccWCountChar = new JLabel("Anzahl Charaktere");
    lblAccWCountChar.setBounds(131, 113, 127, 14);
    pAccAusw.add(lblAccWCountChar);

    pAcc = new JPanel();
    pAcc.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentShown(ComponentEvent arg0) {}
        });
    tabbedPane.addTab("Account", null, pAcc, null);
    pAcc.setLayout(null);

    JLabel lblAccountname = new JLabel("Account-Name:");
    lblAccountname.setBounds(10, 11, 86, 14);
    pAcc.add(lblAccountname);

    txtAccName = new JTextField();
    txtAccName.setBounds(106, 8, 158, 20);
    pAcc.add(txtAccName);
    txtAccName.setColumns(10);

    JLabel lblAccountEmail = new JLabel("Email-Adresse:");
    lblAccountEmail.setBounds(10, 42, 86, 14);
    pAcc.add(lblAccountEmail);

    JLabel lblAccountPW = new JLabel("Passwort:");
    lblAccountPW.setBounds(10, 73, 86, 14);
    pAcc.add(lblAccountPW);

    txtAccEmail = new JTextField();
    txtAccEmail.setColumns(10);
    txtAccEmail.setBounds(106, 39, 158, 20);
    pAcc.add(txtAccEmail);

    txtAccPW = new JTextField();
    txtAccPW.setColumns(10);
    txtAccPW.setBounds(106, 70, 158, 20);
    pAcc.add(txtAccPW);

    txtAccCountChar = new JTextField();
    txtAccCountChar.setBounds(178, 101, 86, 20);
    pAcc.add(txtAccCountChar);
    txtAccCountChar.setColumns(10);

    JLabel lblAccountCountChar = new JLabel("Anzahl Char.");
    lblAccountCountChar.setBounds(106, 101, 62, 14);
    pAcc.add(lblAccountCountChar);

    pCharAusw = new JPanel();
    pCharAusw.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentShown(ComponentEvent arg0) {}
        });
    tabbedPane.addTab("Charakterauswahl", null, pCharAusw, null);
    pCharAusw.setLayout(null);

    JLabel lblName = new JLabel("Name");
    lblName.setBounds(134, 12, 46, 14);
    pCharAusw.add(lblName);

    lblCharWName = new JLabel("CharName");
    lblCharWName.setBounds(134, 37, 152, 14);
    pCharAusw.add(lblCharWName);

    JLabel lblRace = new JLabel("Rasse");
    lblRace.setBounds(134, 62, 46, 14);
    pCharAusw.add(lblRace);

    lblCharWRace = new JLabel("CharRasse");
    lblCharWRace.setBounds(190, 62, 96, 14);
    pCharAusw.add(lblCharWRace);

    JLabel lblProfession = new JLabel("Klasse");
    lblProfession.setBounds(134, 87, 46, 14);
    pCharAusw.add(lblProfession);

    lblCharWProfession = new JLabel("CharKlasse");
    lblCharWProfession.setBounds(190, 87, 96, 14);
    pCharAusw.add(lblCharWProfession);

    JLabel lblLevel = new JLabel("Level");
    lblLevel.setBounds(134, 112, 46, 14);
    pCharAusw.add(lblLevel);

    lblCharWLevel = new JLabel("CharLevel");
    lblCharWLevel.setBounds(190, 112, 46, 14);
    pCharAusw.add(lblCharWLevel);

    cbCharLevel = new JComboBox<String>();

    lCharakter = new JList<String>(Charlist);
    lCharakter.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {}
        });
    lCharakter.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lCharakter.setBounds(10, 11, 114, 335);
    pCharAusw.add(lCharakter);

    pCharakter = new JPanel();
    pCharakter.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentShown(ComponentEvent arg0) {}
        });
    tabbedPane.addTab("Charakter", null, pCharakter, null);
    pCharakter.setLayout(null);

    JLabel lblCharName = new JLabel("Charakter-Name:");
    lblCharName.setBounds(10, 11, 86, 14);
    pCharakter.add(lblCharName);

    txtCharName = new JTextField();
    txtCharName.setColumns(10);
    txtCharName.setBounds(106, 8, 145, 20);
    pCharakter.add(txtCharName);

    lblCharRace = new JLabel("Rasse");
    lblCharRace.setBounds(10, 43, 46, 14);
    pCharakter.add(lblCharRace);

    cbCharRace = new JComboBox<String>();
    cbCharRace.setBounds(106, 39, 91, 22);
    pCharakter.add(cbCharRace);

    JLabel lblCharProfession = new JLabel("Klasse");
    lblCharProfession.setBounds(10, 76, 46, 14);
    pCharakter.add(lblCharProfession);

    cbCharProfession = new JComboBox<String>();
    cbCharProfession.setBounds(106, 72, 91, 22);
    pCharakter.add(cbCharProfession);

    cbCharLevel.setBounds(106, 105, 91, 22);
    pCharakter.add(cbCharLevel);

    JLabel lblCharLevel = new JLabel("Level");
    lblCharLevel.setBounds(10, 109, 46, 14);
    pCharakter.add(lblCharLevel);

    cbCharCraftDisc1 = new JComboBox<String>();
    cbCharCraftDisc1.setBounds(106, 138, 91, 22);
    pCharakter.add(cbCharCraftDisc1);

    JLabel lblCharCraftDisc1 = new JLabel("Beruf 1");
    lblCharCraftDisc1.setBounds(10, 142, 46, 14);
    pCharakter.add(lblCharCraftDisc1);

    cbCharCraftDisc2 = new JComboBox<String>();
    cbCharCraftDisc2.setBounds(106, 171, 91, 22);
    pCharakter.add(cbCharCraftDisc2);

    JLabel lblCharCraftDisc2 = new JLabel("Beruf 2");
    lblCharCraftDisc2.setBounds(10, 175, 46, 14);
    pCharakter.add(lblCharCraftDisc2);

    JButton btnNew = new JButton("Neu");
    btnNew.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {}
        });
    btnNew.setBounds(10, 393, 70, 23);
    contentPane.add(btnNew);
  }
Пример #21
0
  /** Create the frame. */
  public void init() {
    setResizable(false);
    setTitle("GTD");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 607, 472);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    txtTaskText = new JTextField();

    txtTaskText.setBounds(10, 11, 406, 20);
    contentPane.add(txtTaskText);
    txtTaskText.setColumns(10);

    btnAddTask = new JButton("Aufgabe hinzuf\u00FCgen");

    btnAddTask.setEnabled(false);
    btnAddTask.setFont(new Font("Tahoma", Font.PLAIN, 12));
    btnAddTask.setBounds(426, 11, 165, 23);
    contentPane.add(btnAddTask);

    btnChangeTask = new JButton("Aufgabe \u00E4ndern");

    btnChangeTask.setEnabled(false);
    btnChangeTask.setFont(new Font("Tahoma", Font.PLAIN, 12));
    btnChangeTask.setBounds(426, 45, 165, 23);
    contentPane.add(btnChangeTask);

    JPanel panel = new JPanel();
    panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panel.setBounds(10, 75, 581, 307);
    contentPane.add(panel);
    panel.setLayout(null);

    JLabel lblListen = new JLabel("Listen");
    lblListen.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblListen.setBounds(20, 20, 46, 14);
    panel.add(lblListen);

    JLabel lblAufgaben = new JLabel("Aufgaben");
    lblAufgaben.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblAufgaben.setBounds(173, 20, 69, 14);
    panel.add(lblAufgaben);

    lstTask = new JList();

    lstTask.setBorder(new LineBorder(new Color(0, 0, 0)));
    lstTask.setBounds(173, 45, 365, 239);
    JScrollPane scrollPane =
        new JScrollPane(
            lstTask,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setLocation(173, 45);
    scrollPane.setSize(398, 239);
    panel.add(scrollPane);

    lstList = new JList();
    lstList.setBorder(new LineBorder(new Color(0, 0, 0)));
    lstList.setBounds(20, 46, 141, 238);
    panel.add(lstList);
    btnCompletedTask = new JButton("Erledigte Aufgaben l\u00F6schen");
    btnCompletedTask.setFont(new Font("Tahoma", Font.PLAIN, 10));
    btnCompletedTask.setBounds(10, 393, 181, 20);
    contentPane.add(btnCompletedTask);
    btnMoveTask = new JButton("Aufgabe verschieben");
    btnMoveTask.setFont(new Font("Tahoma", Font.PLAIN, 10));
    btnMoveTask.setBounds(197, 393, 181, 20);
    btnMoveTask.setEnabled(false);
    contentPane.add(btnMoveTask);
    btnShowOverview = new JButton("\u00DCbersicht anzeigen");
    btnShowOverview.setFont(new Font("Tahoma", Font.PLAIN, 10));
    btnShowOverview.setBounds(388, 393, 181, 20);
    contentPane.add(btnShowOverview);
    this.setVisible(true);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setResizable(false);
    frame.setBounds(100, 100, 550, 400);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    final JButton btnRemover = new JButton("Remover");
    final JButton btnEditar = new JButton("Editar");
    DefaultListModel listAux = new DefaultListModel();
    for (Autor a : biblioteca.getlistaAutores()) {
      listAux.addElement(a.getNome());
    }
    final JList list = new JList(listAux);
    list.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            Autor a =
                admin.procurarAutor(
                    list.getSelectedValue().toString(), biblioteca.getlistaAutores());
            textFieldNome.setText(a.getNome());
            textFieldEmail.setText(a.getEmail());
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            textFieldDataNascimento.setText(sdf.format(a.getDataNascimento()).toString());
            btnRemover.setEnabled(true);
            btnEditar.setEnabled(true);
          }
        });
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setBounds(12, 12, 172, 353);
    frame.getContentPane().add(list);

    JLabel lblNome = new JLabel("Nome");
    lblNome.setBounds(207, 71, 70, 15);
    frame.getContentPane().add(lblNome);

    JLabel lblEmail = new JLabel("Email");
    lblEmail.setBounds(207, 102, 114, 15);
    frame.getContentPane().add(lblEmail);

    textFieldEmail = new JTextField();
    textFieldEmail.setEditable(false);
    textFieldEmail.setColumns(10);
    textFieldEmail.setBounds(374, 100, 162, 19);
    frame.getContentPane().add(textFieldEmail);

    JLabel lblDataNascimento = new JLabel("Data Nascimento");
    lblDataNascimento.setBounds(207, 133, 128, 15);
    frame.getContentPane().add(lblDataNascimento);

    textFieldDataNascimento = new JTextField();
    textFieldDataNascimento.setEditable(false);
    textFieldDataNascimento.setColumns(10);
    textFieldDataNascimento.setBounds(374, 131, 162, 19);
    frame.getContentPane().add(textFieldDataNascimento);

    textFieldNome = new JTextField();
    textFieldNome.setEditable(false);
    textFieldNome.setColumns(10);
    textFieldNome.setBounds(374, 69, 162, 19);
    frame.getContentPane().add(textFieldNome);

    JButton button = new JButton("Novo");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            try {
              WindowAdicionarAutor window = new WindowAdicionarAutor(biblioteca, admin);
              window.frame.setVisible(true);
              frame.setVisible(false);
              frame.dispose();
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
    button.setBounds(419, 12, 117, 25);
    frame.getContentPane().add(button);

    final JButton btnSair = new JButton("Sair");
    btnRemover.setEnabled(false);
    btnEditar.setEnabled(false);
    btnSair.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (toogleSair) {
              frame.setVisible(false);
              frame.dispose();
            } else {
              btnEditar.setText("Editar");
              btnSair.setText("Sair");
              btnRemover.setEnabled(true);
              toogleEditar = true;
              toogleSair = true;

              textFieldEmail.setEditable(false);
              textFieldDataNascimento.setEditable(false);
              textFieldNome.setEditable(false);
            }
          }
        });
    btnSair.setBounds(435, 340, 101, 25);
    frame.getContentPane().add(btnSair);

    btnRemover.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            admin.removerAutor(list.getSelectedValue().toString(), biblioteca.getlistaAutores());
            frame.setVisible(false);
            frame.dispose();

            try {

              biblioteca.save(2);
              WindowSucesso window = new WindowSucesso();
              window.frame.setVisible(true);

            } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });
    btnRemover.setBounds(322, 340, 101, 25);
    frame.getContentPane().add(btnRemover);

    btnEditar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (toogleEditar) {
              btnEditar.setText("Guardar");
              btnSair.setText("Cancelar");
              btnRemover.setEnabled(false);
              toogleEditar = false;
              toogleSair = false;
              textFieldEmail.setEditable(true);
              textFieldDataNascimento.setEditable(true);
              textFieldNome.setEditable(true);

            } else {
              btnEditar.setText("Editar");
              btnSair.setText("Sair");
              btnRemover.setEnabled(true);
              toogleEditar = true;
              toogleSair = true;

              textFieldEmail.setEditable(false);
              textFieldDataNascimento.setEditable(false);
              textFieldNome.setEditable(false);

              DateFormat formatter;
              Date date;
              formatter = new SimpleDateFormat("yyyy-MM-dd");
              String nome_autor = list.getSelectedValue().toString();

              try {
                date = formatter.parse(textFieldDataNascimento.getText());

                admin.adicionarAutor(
                    textFieldNome.getText(),
                    date,
                    textFieldEmail.getText(),
                    biblioteca.getlistaAutores());
                admin.removerAutor(nome_autor, biblioteca.getlistaAutores());

                biblioteca.save(2);

                frame.setVisible(false);
                frame.dispose();

                WindowSucesso window = new WindowSucesso();
                window.frame.setVisible(true);

              } catch (ParseException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (Exception e1) {
                e1.printStackTrace();
              }
            }
          }
        });
    btnEditar.setBounds(207, 340, 101, 25);
    frame.getContentPane().add(btnEditar);
  }
Пример #23
0
  Library() {
    super("Library Management");
    frame = this;
    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception de) {
    }

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

    // Adding TextArea in Panel
    jp1 = new JPanel(null, true);
    // t1=new
    // JTextField("|Name    "+"\t\t"+"  |Author"+"\t\t "+" |Publication   "+"\t"+"|Issue
    // "+"\t"+"|Return    "+"\t"+"|  Cutm. Id");
    // t1.setEditable(false);
    // t1.setBounds(0,0,600,20);
    // jp1.add(t1);

    MenuBar mb = new MenuBar();
    setMenuBar(mb);
    Menu menu2 = new Menu("Skins");
    MenuItem item4 = new MenuItem("Defualt Skin");
    MenuItem item5 = new MenuItem("Metal Skin");
    MenuItem item6 = new MenuItem("Modified Skin");
    // item5.setSelected(true);
    menu2.add(item4);
    menu2.add(item5);
    menu2.add(item6);
    mb.add(menu2);

    Menu menu21 = new Menu("Backup");
    MenuItem item61 = new MenuItem("Create Database Backup");
    menu21.add(item61);
    mb.add(menu21);

    // Menu menu1=new Menu("About");
    // MenuItem item1=new MenuItem("Help ?");
    // MenuItem item2=new MenuItem("Support ?");
    // MenuItem item3=new MenuItem("About Us ?");
    // menu1.add(item1);menu1.add(item2);menu1.add(item3);
    // mb.add(menu1);

    Menu menu212 = new Menu("Exit");
    MenuItem item612 = new MenuItem("Exit Form Library");
    menu212.add(item612);
    mb.add(menu212);

    int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;

    Color re = new Color(122, 145, 201);

    mo1 = new DefaultListModel();
    list1 = new JList(mo1);
    ml1 = new JLabel("    Book's Name");
    ml1.setForeground(Color.red);
    ml1.setBounds(15, 0, 154, 20);
    list1.setBounds(15, 20, 154, 500);
    list1.setToolTipText("NAme of Book's Present in Database");
    jp1.add(ml1);
    jp1.add(list1);

    mo2 = new DefaultListModel();
    list2 = new JList(mo2);
    ml2 = new JLabel("   Author");
    ml2.setForeground(re);
    ml2.setBounds(140 + 30, 0, 99, 20);
    list2.setToolTipText("Name of Book Author's Present in Database");
    list2.setBounds(140 + 30, 20, 99, 900);
    jp1.add(ml2);
    jp1.add(list2);

    mo3 = new DefaultListModel();
    list3 = new JList(mo3);
    ml3 = new JLabel("   Publication");
    ml3.setForeground(re);
    ml3.setBounds(240 + 30, 0, 99, 20);
    list3.setToolTipText("Name of Book's Publication Present in Database");
    list3.setBounds(240 + 30, 20, 99, 500);
    jp1.add(ml3);
    jp1.add(list3);

    mo4 = new DefaultListModel();
    list4 = new JList(mo4);
    ml4 = new JLabel("  Issue Date");
    ml4.setForeground(re);
    ml4.setBounds(340 + 30, 0, 70, 20);
    list4.setToolTipText("Date of Issue Present in Database");
    list4.setBounds(340 + 30, 20, 70, 500);
    jp1.add(ml4);
    jp1.add(list4);

    mo5 = new DefaultListModel();
    list5 = new JList(mo5);
    ml5 = new JLabel("   Return Date");
    ml5.setForeground(re);
    ml5.setBounds(411 + 30, 0, 70, 20);
    list5.setToolTipText("Date of Return Present in Database");
    list5.setBounds(411 + 30, 20, 70, 500);
    jp1.add(ml5);
    jp1.add(list5);

    mo6 = new DefaultListModel();
    list6 = new JList(mo6);
    ml6 = new JLabel("   Cust. ID");
    ml6.setForeground(re);
    ml6.setBounds(482 + 30, 0, 60, 20);
    list6.setToolTipText("ID of customer that purchase the book last time ");
    list6.setBounds(482 + 30, 20, 60, 500);
    jp1.add(ml6);
    jp1.add(list6);

    // a1=new JTextArea();
    // a1.setText("|Name    "+"\t\t\t"+"  |Author"+"\t\t\t"+" |Publication   "+"\t\t"+"|Issue
    // "+"\t\t"+"|Return    "+"\t\t"+"|  Cutm. Id");
    // a1.setEditable(false);
    // JScrollPane scroll=new JScrollPane(a1,v,h);
    // scroll.setBounds(0,20,600,578);
    // jp1.add(scroll);

    for (int x = 1; x < 100; x++) {
      sr = new JLabel(x + "\n");
      sr.setForeground(re);
      sr.setBounds(0, 20, 10, 500);
      jp1.add(sr);
    }

    // jp1.setBackground(Color.black);
    JScrollPane nm = new JScrollPane(jp1, v, h);
    nm.setBounds(10, 20, 600, 500);
    cp.add(nm);

    jp2 = new JPanel(null, true);

    b1 = new JButton("Add Book");
    b1.setBounds(10, 10, 120, 25);
    jp2.add(b1);

    b2 = new JButton("Delete Book");
    b2.setBounds(10, 45, 120, 25);
    jp2.add(b2);

    b3 = new JButton("View Book Details");
    b3.setBounds(10, 80, 120, 25);
    jp2.add(b3);

    b4 = new JButton("View All Book's");
    b4.setBounds(10, 115, 120, 25);
    jp2.add(b4);

    Color r = new Color(122, 145, 201);
    jp2.setBackground(r);
    jp2.setBounds(630, 20, 160, 145);
    cp.add(jp2);

    jp3 = new JPanel(null, true);

    t1 = new JTextField();
    t1.setBounds(10, 10, 120, 20);
    jp3.add(t1);
    t1.setToolTipText("Find The Book By Book Name. It is Advaced Search System");

    b5 = new JButton("Search Book Name");
    b5.setBounds(05, 35, 130, 20);
    jp3.add(b5);
    // b5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,Event.CTRL_MASK));
    b5.setMnemonic(KeyEvent.VK_N);

    JLabel lk = new JLabel("__________________________________");
    lk.setForeground(Color.black);
    lk.setBounds(0, 50, 160, 6);
    jp3.add(lk);

    t14 = new JTextField();
    t14.setBounds(10, 60, 120, 20);
    jp3.add(t14);
    t14.setToolTipText("Find The Book By Author Name. It is Advaced Search System");

    b10 = new JButton("Search Author");
    b10.setBounds(05, 85, 130, 20);
    jp3.add(b10);

    // b10.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_a,Event.CTRL_MASK));
    b10.setMnemonic(KeyEvent.VK_N);

    Color r1 = new Color(122, 145, 201);
    jp3.setBackground(r1);
    jp3.setBounds(630, 180, 160, 115);
    cp.add(jp3);

    jp4 = new JPanel(null, true);

    b15 = new JButton("Add Customer");
    b15.setBounds(10, 05, 120, 25);
    jp4.add(b15);

    b6 = new JButton("View all Cotumers");
    b6.setBounds(10, 35, 120, 25);
    jp4.add(b6);

    t2 = new JTextField();
    t2.setBounds(10, 65, 120, 20);
    t2.setToolTipText("Find The Customer Information. It is Advaced Search System");
    jp4.add(t2);

    b7 = new JButton("Search");
    b7.setBounds(05, 90, 130, 20);
    jp4.add(b7);

    b8 = new JButton("Delete Costumer");
    b8.setBounds(10, 115, 120, 25);
    jp4.add(b8);

    b9 = new JButton("View Cust. Details");
    b9.setBounds(10, 150, 120, 25);
    jp4.add(b9);

    Color r3 = new Color(122, 145, 201);
    jp4.setBackground(r3);
    jp4.setBounds(630, 305, 160, 180);
    cp.add(jp4);

    b_no = new JLabel();
    b_no.setForeground(Color.red);
    b_no.setBounds(150, 0, 150, 20);
    cp.add(b_no);

    progress1 = new JProgressBar();
    progress1.setBackground(re);
    progress1.setBounds(630, 490, 150, 25);
    cp.add(progress1);

    try {
      rd1 = new FileReader("Database/pointer.mmm");
      read1 = new JTextField();
      read1.read(rd1, null);
      int count = Integer.parseInt(read1.getText());
      int total = count - 1;
      int blk = 0;
      rd1.close();

      for (int i = 1; i < count; i++) {
        rd1 = new FileReader("Database/" + i + ".name");
        read1 = new JTextField();
        read1.read(rd1, null);
        if (!read1.getText().equals("")) {
          blk++;
          b_no.setText("Total Books = " + blk + " (Book's)");
          mo1.addElement(read1.getText() + "");
          rd1.close();

          int per = i * 100 / total;
          progress1.setValue(per);

          rd1 = new FileReader("Database/" + i + ".author");
          read1 = new JTextField();
          read1.read(rd1, null);
          mo2.addElement(read1.getText() + "");
          rd1.close();

          rd1 = new FileReader("Database/" + i + ".publication");
          read1 = new JTextField();
          read1.read(rd1, null);
          mo3.addElement(read1.getText() + "");
          rd1.close();

          rd1 = new FileReader("Database/" + i + ".issue");
          read1 = new JTextField();
          read1.read(rd1, null);
          if (!read1.getText().equals("")) {
            mo4.addElement(read1.getText() + "");
          } else {
            mo4.addElement(read1.getText() + "   -");
          }
          rd1.close();

          rd1 = new FileReader("Database/" + i + ".return");
          read1 = new JTextField();
          read1.read(rd1, null);
          mo5.addElement(read1.getText() + "");
          rd1.close();

          rd1 = new FileReader("Database/" + i + ".id");
          read1 = new JTextField();
          read1.read(rd1, null);
          mo6.addElement(read1.getText() + "");
          rd1.close();
        }
      }
    } catch (Exception der) {
      a1.setText("Error Occurs: \n" + der);
    }

    // Source code for searching the book's from Database
    // it search book by name of book,author,publication
    // it work when you don't know about any thing than press any
    // keyword to find book/
    // eg: if you have book name that publish by that publication which
    // starts from "c"
    // then you press only "c" in search it show you all Books that start
    // with "c" ,Author "c" and publication that start "c" .

    // Warning:
    // Don't Modify the code without knowledge of full source code
    // Author : Pravin Rane

    b5.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              int bs1 = 0;
              progress1.setValue(0);
              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              ml1.setText("Book Name");
              ml2.setText("Author");
              ml3.setText("Publication");
              ml4.setText("Issue Date");
              ml5.setText("Return Date");
              ml6.setText("Cust. ID.");

              if (!t1.getText().equals("")) {
                rd1 = new FileReader("Database/pointer.mmm");
                read1 = new JTextField();
                read1.read(rd1, null);
                int no = Integer.parseInt(read1.getText());
                rd1.close();

                int len = t1.getText().length();
                for (int k = 0; k < len; k++) {
                  char ch = t1.getText().charAt(k);
                  stra1 = stra1 + ch;
                  // System.out.println(stra1+"");
                }

                for (int v = 1; v < no; v++) {
                  name11 = "";
                  author11 = "";
                  publication11 = "";
                  progress1.setMaximum(no);

                  int per = v * 100 / no;
                  progress1.updateUI();
                  progress1.setValue(per);

                  FileReader re1 = new FileReader("Database/" + v + ".name");
                  JTextField jt1 = new JTextField();
                  jt1.read(re1, null);
                  String name = jt1.getText();
                  re1.close();

                  FileReader re2 = new FileReader("Database/" + v + ".author");
                  JTextField jt2 = new JTextField();
                  jt2.read(re2, null);
                  String author = jt2.getText();
                  re2.close();

                  FileReader re3 = new FileReader("Database/" + v + ".publication");
                  JTextField jt3 = new JTextField();
                  jt3.read(re3, null);
                  String publication = jt3.getText();
                  re3.close();
                  find = v;

                  try {
                    for (int z = 0; z < len; z++) {

                      name11 = name11 + name.charAt(z);

                      // author11=author11+author.charAt(z);
                      // System.out.println(author11+"");
                      publication11 = publication11 + publication.charAt(z);
                      if (z == (len - 1)) {
                        // System.out.println(name11+"");
                        // System.out.println(publication11+"");
                      }
                    }

                  } catch (Exception def) {
                  }

                  if (name.toLowerCase().equals(t1.getText())
                      || name.toUpperCase().equals(t1.getText())
                      || author.toLowerCase().equals(t1.getText())
                      || author.toUpperCase().equals(t1.getText())
                      || publication.toLowerCase().equals(t1.getText())
                      || publication.toUpperCase().equals(t1.getText())) {
                    bs1++;
                    rd1 = new FileReader("Database/" + find + ".name");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo1.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo2.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo3.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo4.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo5.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo6.addElement(read1.getText() + "");
                    rd1.close();

                  } else if (publication11.toLowerCase().equals(t1.getText())
                      || author11.toLowerCase().equals(t1.getText())
                      || name11.toLowerCase().equals(t1.getText())
                      || publication11.toUpperCase().equals(t1.getText())
                      || author11.toUpperCase().equals(t1.getText())
                      || name11.toUpperCase().equals(t1.getText())) {
                    bs1++;

                    rd1 = new FileReader("Database/" + find + ".name");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo1.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo2.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo3.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo4.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo5.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo6.addElement(read1.getText() + "");
                    rd1.close();
                  }

                  b_no.setText("Total Book Found =" + bs1 + " (Book's)");
                }

              } else {
                progress1.setValue(0);
                JOptionPane.showMessageDialog(
                    (Component) null,
                    "Please Enter the Book Name or Publcation",
                    "Library Management(Pravin Rane)",
                    JOptionPane.OK_OPTION);
                b_no.setText("User Input Error!");
              }

            } catch (Exception der) {
              System.out.println("Error:" + der);
            }
          }
        });

    b10.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              int bs2 = 0;
              progress1.setValue(0);
              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              ml1.setText("Book Name");
              ml2.setText("Author");
              ml3.setText("Publication");
              ml4.setText("Issue Date");
              ml5.setText("Return Date");
              ml6.setText("Cust. ID.");

              if (!t14.getText().equals("")) {

                rd1 = new FileReader("Database/pointer.mmm");
                read1 = new JTextField();
                read1.read(rd1, null);
                int no = Integer.parseInt(read1.getText());
                rd1.close();

                int len = t14.getText().length();
                for (int k = 0; k < len; k++) {
                  char ch = t14.getText().charAt(k);
                  stra1 = stra1 + ch;
                  // System.out.println(stra1+"");
                }

                for (int v = 1; v < no; v++) {
                  name11 = "";
                  author11 = "";
                  publication11 = "";
                  progress1.setMaximum(no);

                  int per = v * 100 / no;
                  progress1.updateUI();
                  progress1.setValue(per);

                  FileReader re1 = new FileReader("Database/" + v + ".name");
                  JTextField jt1 = new JTextField();
                  jt1.read(re1, null);
                  String name = jt1.getText();
                  re1.close();

                  FileReader re2 = new FileReader("Database/" + v + ".author");
                  JTextField jt2 = new JTextField();
                  jt2.read(re2, null);
                  String author = jt2.getText();
                  re2.close();

                  FileReader re3 = new FileReader("Database/" + v + ".publication");
                  JTextField jt3 = new JTextField();
                  jt3.read(re3, null);
                  String publication = jt3.getText();
                  re3.close();
                  find = v;

                  try {
                    for (int z = 0; z < len; z++) {

                      // name11=name11+name.charAt(z);

                      author11 = author11 + author.charAt(z);
                      // System.out.println(author11+"");
                      // publication11=publication11+publication.charAt(z);
                      if (z == (len - 1)) {
                        // System.out.println(name11+"");
                        // System.out.println(publication11+"");
                      }
                    }

                  } catch (Exception def) {
                  }

                  if (author.toLowerCase().equals(t14.getText())
                      || author.toUpperCase().equals(t14.getText())) {
                    bs2++;
                    rd1 = new FileReader("Database/" + find + ".name");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo1.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo2.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo3.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo4.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo5.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo6.addElement(read1.getText() + "");
                    rd1.close();

                  } else if (author11.toLowerCase().equals(t14.getText())
                      || author11.toUpperCase().equals(t14.getText())) {
                    bs2++;

                    rd1 = new FileReader("Database/" + find + ".name");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo1.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo2.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo3.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo4.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo5.addElement(read1.getText() + "");
                    rd1.close();

                    rd1 = new FileReader("Database/" + find + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    mo6.addElement(read1.getText() + "");
                    rd1.close();
                  }

                  b_no.setText("Total Book Found =" + bs2 + " (Book's)");
                }
              } else {
                progress1.setValue(0);
                b_no.setText("User Input Error!");
                JOptionPane.showMessageDialog(
                    (Component) null,
                    "Please Enter the Book Author name",
                    "Library Management(Pravin Rane)",
                    JOptionPane.OK_OPTION);
              }
            } catch (Exception der) {
              System.out.println("Error:" + der);
            }
          }
        });

    // End of Serching Book
    // Author : Pravin Rane

    // it use to aplly the skins to UserInteface
    // there are three skins Default which is Windows Skin
    // Metal skin and modified skin.
    // apply it as oer ur requirment.
    // Author : Pravin H. Rane

    item4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              SwingUtilities.updateComponentTreeUI(frame);
            } catch (Exception dert) {
              System.out.println(dert);
            }
          }
        });

    item5.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
              SwingUtilities.updateComponentTreeUI(frame);
            } catch (Exception dert) {
              System.out.println(dert);
            }
          }
        });

    item6.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
              SwingUtilities.updateComponentTreeUI(frame);
            } catch (Exception dert) {
              System.out.println(dert);
            }
          }
        });

    item61.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              Date d = new Date();
              int my1 = d.getDate();
              int my2 = d.getMonth();

              FileDialog fd =
                  new FileDialog(frame, "Save Database Backup File (Library Management )");
              fd.setMode(FileDialog.SAVE);
              fd.setFile("Database" + my1 + "." + my2 + ".rar");
              fd.setVisible(true);
              String dir = fd.getDirectory();
              String path = fd.getFile();

              String command = "jar cvf Database1.rar Database/*.*";
              Runtime r = Runtime.getRuntime();
              r.exec(command);

              String command2 = "jar cvf  Database2.rar Cust_Details/*.*";
              Runtime r2 = Runtime.getRuntime();
              r2.exec(command2);

              try {
                Thread.sleep(1000);
              } catch (Exception fr) {
              }
              String command3 = "jar cvf " + dir + path + " Database1.rar  Database2.rar";
              Runtime r3 = Runtime.getRuntime();
              r3.exec(command3);

              System.out.println("Database Backup Sucessfully!");

            } catch (Exception dert) {
              System.out.println(dert);
            }
          }
        });

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

    // End Of Applyinf Skin to UInterface

    // This Button show the details of Book's
    // that specified when the book is adding in the database
    // you can modify the details of book.
    // Author : Pravin H. Rane

    b3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              // view v=new view(String str,string info,boolean val);

            } catch (Exception der) {
            }
          }
        });

    // End of book details

    b15.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Addcust ad = new Addcust();
            ad.setVisible(true);
            ad.setSize(380, 400);
            ad.setLocation(80, 140);
          }
        });

    // it show all book's available in database
    // it dosn't sort book by sequensely
    // you can modify the code for sorting the book as per your requirement
    // Author : Pravin

    b1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            addBook a = new addBook();
          }
        });

    b4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            try {
              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              ml1.setText("Book Name");
              ml2.setText("Author");
              ml3.setText("Publication");
              ml4.setText("Issue Date");
              ml5.setText("Return Date");
              ml6.setText("Cust. ID.");
              int za = 0;

              rd1 = new FileReader("Database/pointer.mmm");
              read1 = new JTextField();
              read1.read(rd1, null);
              int count = Integer.parseInt(read1.getText());
              int total = count - 1;

              rd1.close();

              for (int i = 1; i < count; i++) {

                rd1 = new FileReader("Database/" + i + ".name");
                read1 = new JTextField();
                read1.read(rd1, null);
                if (!read1.getText().equals("")) {
                  za++;
                  b_no.setText("Total Books = " + za + " (Book's)");
                  mo1.addElement(read1.getText() + "");
                  rd1.close();

                  progress1.setMaximum(total);
                  int per = i * 100 / total;
                  progress1.setValue(per);

                  rd1 = new FileReader("Database/" + i + ".author");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  mo2.addElement(read1.getText() + "");
                  rd1.close();

                  rd1 = new FileReader("Database/" + i + ".publication");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  mo3.addElement(read1.getText() + "");
                  rd1.close();

                  rd1 = new FileReader("Database/" + i + ".issue");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  if (!read1.getText().equals("")) {
                    mo4.addElement(read1.getText() + "");
                  } else {
                    mo4.addElement(read1.getText() + "   _");
                  }
                  rd1.close();

                  rd1 = new FileReader("Database/" + i + ".return");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  mo5.addElement(read1.getText() + "");
                  rd1.close();

                  rd1 = new FileReader("Database/" + i + ".id");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  mo6.addElement(read1.getText() + "");
                  rd1.close();

                  progress1.setValue(100);
                }
              }
            } catch (Exception der) {
              a1.setText("Error Occurs: \n" + der);
            }
          }
        });
    // End of View all Book's

    // This source code is used to show information of all customers
    // Author :Pravin Rane

    b6.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {

              ml1.setText("Cust. ID");
              ml2.setText("Cust. Name");
              ml3.setText("Registration Date");
              ml4.setText("Book Name");
              ml5.setText("Purchase Date");
              ml6.setText("Return Date");

              int z12 = 0;

              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              rd2 = new FileReader("Cust_Details/pointer.mmm");
              jt2 = new JTextField();
              jt2.read(rd2, null);
              rd2.close();

              int no = Integer.parseInt(jt2.getText());
              int tt = no - 1;
              // b_no.setText("Total Customer's :"+tt );

              for (int v = 1; v < no; v++) {

                rd2 = new FileReader("Cust_Details/Cus" + v + ".id");
                jt2 = new JTextField();
                jt2.read(rd2, null);
                if (!jt2.getText().equals("")) {
                  z12++;
                  b_no.setText("Total Customers = " + z12);
                  mo1.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".name");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo2.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".date");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo3.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".bname");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo4.addElement(jt2.getText() + "");
                  } else {
                    mo4.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo5.addElement(jt2.getText() + "");
                  } else {
                    mo5.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".return");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo6.addElement(jt2.getText() + "");
                  } else {
                    mo6.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();
                }
              }

            } catch (Exception ser) {
              System.out.println(ser);
            }
          }
        });
    // End of showing customer's Info.

    b9.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {

              int ad = list1.getSelectedIndex();
              String str = (String) mo1.getElementAt(ad);

              System.out.println(str);

              cust_detail d = new cust_detail(str);
              d.setVisible(true);
              d.setSize(300, 550);
              d.setLocation(100, 0);
            } catch (Exception fr) {
              JOptionPane.showMessageDialog(
                  (Component) null,
                  "Please Select Customer ID from List of Cust. ID. ",
                  "Library Management(Pravin Rane)",
                  JOptionPane.OK_OPTION);
              try {
                ml1.setText("Cust. ID");
                ml2.setText("Cust. Name");
                ml3.setText("Registration Date");
                ml4.setText("Book Name");
                ml5.setText("Purchase Date");
                ml6.setText("Return Date");

                mo1.removeAllElements();
                mo2.removeAllElements();
                mo3.removeAllElements();
                mo4.removeAllElements();
                mo5.removeAllElements();
                mo6.removeAllElements();

                rd2 = new FileReader("Cust_Details/pointer.mmm");
                jt2 = new JTextField();
                jt2.read(rd2, null);
                rd2.close();
                int no = Integer.parseInt(jt2.getText());

                for (int v = 1; v < no; v++) {
                  rd2 = new FileReader("Cust_Details/Cus" + v + ".id");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo1.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".name");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo2.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".date");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  mo3.addElement(jt2.getText() + "");
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".bname");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo4.addElement(jt2.getText() + "");
                  } else {
                    mo4.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo5.addElement(jt2.getText() + "");
                  } else {
                    mo5.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".return");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  if (!jt2.getText().equals("")) {
                    mo6.addElement(jt2.getText() + "");
                  } else {
                    mo6.addElement(jt2.getText() + "   _");
                  }
                  rd2.close();
                }
              } catch (Exception fg) {
              }
            }
          }
        });

    b7.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String mysearchid = t2.getText();
            try {
              ml1.setText("Cust. ID");
              ml2.setText("Cust. Name");
              ml3.setText("Registration Date");
              ml4.setText("Book Name");
              ml5.setText("Purchase Date");
              ml6.setText("Return Date");

              mo1.removeAllElements();
              mo2.removeAllElements();
              mo3.removeAllElements();
              mo4.removeAllElements();
              mo5.removeAllElements();
              mo6.removeAllElements();

              if (!t2.getText().equals("")) {
                rd2 = new FileReader("Cust_Details/pointer.mmm");
                jt2 = new JTextField();
                jt2.read(rd2, null);
                rd2.close();
                int no = Integer.parseInt(jt2.getText());

                int len3 = t2.getText().length();

                for (int v = 1; v < no; v++) {
                  name22 = "";
                  int lg = 0;
                  rd2 = new FileReader("Cust_Details/Cus" + v + ".id");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  // mo1.addElement(jt2.getText()+"");
                  String s1 = jt2.getText();
                  rd2.close();

                  rd2 = new FileReader("Cust_Details/Cus" + v + ".name");
                  jt2 = new JTextField();
                  jt2.read(rd2, null);
                  // mo2.addElement(jt2.getText()+"");
                  String s2 = jt2.getText();
                  rd2.close();

                  for (int z = 0; z < len3; z++) {
                    name22 = name22 + s2.charAt(z);
                  }

                  if (s1.toLowerCase().equals(mysearchid)
                      || s1.toUpperCase().equals(mysearchid)
                      || s2.toLowerCase().equals(mysearchid)
                      || s2.toUpperCase().equals(mysearchid)
                      || name22.toUpperCase().equals(mysearchid)
                      || name22.toLowerCase().equals(mysearchid)) {
                    lg++;
                    b_no.setText("Customer Found :" + lg);
                    rd2 = new FileReader("Cust_Details/Cus" + v + ".id");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    mo1.addElement(jt2.getText() + "");
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".name");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    mo2.addElement(jt2.getText() + "");
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".date");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    mo3.addElement(jt2.getText() + "");
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".bname");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    if (!jt2.getText().equals("")) {
                      mo4.addElement(jt2.getText() + "");
                    } else {
                      mo4.addElement(jt2.getText() + "   _");
                    }
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".purchase");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    if (!jt2.getText().equals("")) {
                      mo5.addElement(jt2.getText() + "");
                    } else {
                      mo5.addElement(jt2.getText() + "   _");
                    }
                    rd2.close();

                    rd2 = new FileReader("Cust_Details/Cus" + v + ".return");
                    jt2 = new JTextField();
                    jt2.read(rd2, null);
                    if (!jt2.getText().equals("")) {
                      mo6.addElement(jt2.getText() + "");
                    } else {
                      mo6.addElement(jt2.getText() + "   _");
                    }
                    rd2.close();
                  }
                }
              } else {
                progress1.setValue(0);
                b_no.setText("User Input Error!");
                JOptionPane.showMessageDialog(
                    (Component) null,
                    "Please Enter Customer Id or Name",
                    "Library Management(Pravin Rane)",
                    JOptionPane.OK_OPTION);
              }

            } catch (Exception de) {
            }
          }
        });

    b2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int ad = list1.getSelectedIndex();
            String str99 = (String) mo1.getElementAt(ad);
            try {

              rd2 = new FileReader("Database/pointer.mmm");
              jt2 = new JTextField();
              jt2.read(rd2, null);
              rd2.close();
              int nom = Integer.parseInt(jt2.getText());

              for (int count2 = 1; count2 < nom; count2++) {
                rd1 = new FileReader("Database/" + count2 + ".name");
                read1 = new JTextField();
                read1.read(rd1, null);
                rd1.close();

                if (read1.getText().equals(str99)) {
                  wr1 = new FileWriter("Database/" + count2 + ".name");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".author");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".publication");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".issue");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".return");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".detail");
                  wr1.write("");
                  wr1.close();

                  wr1 = new FileWriter("Database/" + count2 + ".id");
                  wr1.write("");
                  wr1.close();
                  try {
                    Library lbc = new Library();
                    setVisible(false);
                    lbc.setVisible(true);
                    lbc.setSize(800, 600);
                  } catch (Exception de) {
                  }
                }
              }

            } catch (Exception fr) {
              System.out.println(fr);
            }
          }
        });

    b3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              int ad = list1.getSelectedIndex();
              String str34 = (String) mo1.getElementAt(ad);

              jf55 = new JFrame("Book Details");
              jf55.setVisible(true);
              jf55.setLayout(null);
              jf55.setLocation(160, 180);

              JTextArea ak47 = new JTextArea();
              ak47.setEditable(false);
              ak47.setText(
                  "Book Details" + "\n" + "**************************************************");
              ak47.setBounds(10, 10, 250, 250);
              jf55.add(ak47);

              Button b1 = new Button("Ok");
              b1.setBounds(80, 270, 100, 25);
              jf55.add(b1);
              b1.addActionListener(
                  new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                      jf55.setVisible(false);
                    }
                  });

              jf55.setSize(285, 335);

              rd2 = new FileReader("Database/pointer.mmm");
              jt2 = new JTextField();
              jt2.read(rd2, null);
              rd2.close();
              int nov = Integer.parseInt(jt2.getText());

              for (int i = 1; i < nov; i++) {
                rd1 = new FileReader("Database/" + i + ".name");
                read1 = new JTextField();
                read1.read(rd1, null);
                String hj = read1.getText();
                rd1.close();

                if (hj.equals(str34)) {
                  rd1 = new FileReader("Database/" + i + ".name");
                  read1 = new JTextField();
                  read1.read(rd1, null);
                  if (!read1.getText().equals("")) {
                    ak47.setText(ak47.getText() + "\n" + "Book Name :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".author");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    ak47.setText(ak47.getText() + "\n" + "Book Author :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".publication");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    ak47.setText(ak47.getText() + "\n" + "Book Publication :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".issue");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    if (!read1.getText().equals("")) {
                      ak47.setText(ak47.getText() + "\n" + "Issue Date :" + read1.getText());
                    } else {
                      ak47.setText(ak47.getText() + "\n" + "Issue Date : None");
                    }
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".return");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    ak47.setText(ak47.getText() + "\n" + "Return Date :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".id");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    ak47.setText(ak47.getText() + "\n" + "Cust. Id :" + read1.getText());
                    rd1.close();

                    rd1 = new FileReader("Database/" + i + ".detail");
                    read1 = new JTextField();
                    read1.read(rd1, null);
                    if (!read1.getText().equals("")) {
                      ak47.setText(ak47.getText() + "\n" + "Other Details : \n" + read1.getText());
                    } else {
                      ak47.setText(ak47.getText() + "\n" + "Other Details : Not Found");
                    }
                    rd1.close();
                  }
                }
              }

            } catch (Exception de) {
              JOptionPane.showMessageDialog(
                  (Component) null,
                  "Please Select Book Name from List",
                  "Library Management(Pravin Rane)",
                  JOptionPane.OK_OPTION);
            }
          }
        });
  }
Пример #24
0
  // Build the form
  public PackagesFrame() {
    super("Packages", true, true, true, true);
    // Hide the frame when closed, don't destroy it as it is only created
    // once
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    getContentPane().setLayout(null);
    getContentPane().setSize(800, 550);

    // Add CRUD buttons
    // Add all panels to form
    getContentPane().add(new JLabel("Viewing Packages"), "North");
    getContentPane().add(pnlCrudPanel, "South");
    pnlCrudPanel.setBounds(0, 496, 756, 31);
    pnlCrudPanel.add(btnDelete);
    pnlCrudPanel.add(btnSave);
    pnlCrudPanel.add(btnEdit);
    {
      jScrollPane1 = new JScrollPane();
      getContentPane().add(jScrollPane1);
      jScrollPane1.setBounds(12, 34, 774, 223);
      btnNew.setBounds(304, 415, 35, 21);
      btnNew.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              addNewRow();
            }
          });
      btnEdit.setBounds(350, 415, 32, 21);
      pnlCrudPanel.add(btnNew);
      btnEdit.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              btnEditMouseClicked(e);
            }
          });
      btnSave.setBounds(393, 415, 38, 21);
      btnSave.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              btnSaveMouseClicked(e);
            }
          });
      btnDelete.setBounds(442, 415, 45, 21);
      btnDelete.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              btnDeleteMouseClicked(e);
            }
          });
      {
        tblPackages = new JTable();
        jScrollPane1.setViewportView(tblPackages);
        tblPackages.setRowHeight(25);
        // initialize package table with result set
        pkgTblModel = new PackagesTableModel();
        tblPackages.setSurrendersFocusOnKeystroke(true);
        tblPackages.setBorder(BorderFactory.createBevelBorder(1));
        tblPackages.addMouseListener(
            new MouseAdapter() {
              public void mousePressed(MouseEvent evt) {}

              public void mouseClicked(java.awt.event.MouseEvent e) {
                int clicked = e.getClickCount();
                if (clicked == 2) {
                  Point pt = e.getPoint();
                  int i = tblPackages.rowAtPoint(pt);
                  int j = tblPackages.columnAtPoint(pt);
                  // System.out.println("<" + i + "," + j + ">");
                  if (j == PackagesTableModel.START_DATE || j == PackagesTableModel.END_DATE) {
                    // show calendar
                    if (JOptionPane.showConfirmDialog(null, calStartDate)
                        == JOptionPane.OK_OPTION) {
                      java.sql.Date d =
                          new java.sql.Date(calStartDate.getCalendar().getTimeInMillis());
                      pkgTblModel.setValueAt(d, i, j);
                    }
                  }
                }
              }
            });
        tblPackages
            .getSelectionModel()
            .addListSelectionListener(
                new ListSelectionListener() {
                  @Override
                  public void valueChanged(ListSelectionEvent e) {
                    //								if (e.getValueIsAdjusting()
                    //										&& (e.getFirstIndex() != e
                    //												.getLastIndex()))
                    listSelectionChaged(e);
                  }
                });

        tblPackages.setModel(pkgTblModel);
        initTable(pkgTblModel, -1);
        // sorter = new TableRowSorter<PackagesTableModel>(pkgTblModel);
        // sorter confuses my table model
        // tblPackages.setRowSorter(sorter);

        tblPackages.setDefaultRenderer(Object.class, new EvenOddRenderer());
        // final NumericTextField ntf = new NumericTextField(currency);
        final NumericTextField ntf = new NumericTextField();
        tblPackages
            .getColumnModel()
            .getColumn(PackagesTableModel.COMMISSION)
            .setCellEditor(new DefaultCellEditor(ntf));
        tblPackages
            .getColumnModel()
            .getColumn(PackagesTableModel.PRICE)
            .setCellEditor(new DefaultCellEditor(ntf));
        ntf.addFocusListener(
            new FocusListener() {
              @Override
              public void focusGained(FocusEvent e) {
                eraseNonNumeric(e);
                NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.CANADA);
                try {
                  Double dblValue =
                      currency.parse(((JTextField) e.getComponent()).getText()).doubleValue();
                  ((JTextField) e.getComponent()).setText(dblValue.toString());
                } catch (ParseException e1) {
                  e1.printStackTrace();
                }
              }

              @Override
              public void focusLost(FocusEvent e) {}
            });
        ntf.addKeyListener(
            new KeyAdapter() {
              public void keyTyped(KeyEvent e) {
                TXLogger.logger.debug("NumericTextFiled: " + e.getKeyCode());
                // System.out.println("NumericTextFiled: "
                // + e.getKeyChar());
                String txtOld = ((JTextField) e.getComponent()).getText();
                if (e.getKeyChar() >= KeyEvent.VK_0 && e.getKeyChar() <= KeyEvent.VK_9) {
                  if (txtOld.indexOf('.') == -1 && txtOld.length() >= 15) {
                    e.consume();
                    return;
                  }
                  return;
                } else if (e.getKeyChar() == '.') {
                  if (((JTextField) e.getComponent()).getText().indexOf('.') > -1) e.consume();
                  TXLogger.logger.debug(
                      "index of ." + ((JTextField) e.getComponent()).getText().indexOf('.'));
                  // System.out.println("index of ."
                  // + ((JTextField) e.getComponent()).getText()
                  // .indexOf('.'));
                } else if (e.getKeyCode() != '\n') {
                  e.consume();
                }
              }
            });
        JTextField cellNotNull = new JTextField();
        tblPackages
            .getColumnModel()
            .getColumn(PackagesTableModel.PACKAGE_NAME)
            .setCellEditor(new DefaultCellEditor(cellNotNull));
        tblPackages
            .getColumnModel()
            .getColumn(PackagesTableModel.DESCRIPTION)
            .setCellEditor(new DefaultCellEditor(cellNotNull));
        cellNotNull.addFocusListener(
            new FocusListener() {
              @Override
              public void focusGained(FocusEvent e) {
                String txt = ((JTextField) (e.getComponent())).getText();
                if ((txt.indexOf((VALUE_REQUIRED)) >= 0)) {
                  ((JTextField) (e.getComponent())).setText("");
                }
              }

              @Override
              public void focusLost(FocusEvent e) {}
            });
        // Column 5 and 6 only accept numeric input
        cellNotNull.addKeyListener(
            new KeyAdapter() {
              public void keyTyped(KeyEvent e) {
                TXLogger.logger.debug(e.getKeyChar());
                // System.out.println(e.getKeyChar());
                if (((JTextField) e.getComponent()).getText().length() >= 100) {
                  e.consume();
                  return;
                }
              }
            });
        // popup memu
        tblPackages.addMouseListener(
            new MouseAdapter() {
              public void mousePressed(MouseEvent evt) {
                if (tblPackages.getSelectedRow() >= 0 && evt.getButton() == MouseEvent.BUTTON3) {
                  popupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
                }
              }
            });
        cellNotNull.addFocusListener(
            new FocusListener() {
              @Override
              public void focusGained(FocusEvent e) {
                if (((JTextField) e.getComponent()).getText().trim().equals(VALUE_REQUIRED)) {
                  ((JTextField) e.getComponent()).setText("");
                }
                ((JTextField) e.getComponent()).setBackground(Color.RED);
              }

              @Override
              public void focusLost(FocusEvent e) {}
            });
        tblPackages.setBounds(32, 12, 700, 203);
        tblPackages.setPreferredSize(new java.awt.Dimension(756, 422));
        popupMenu = new JPopupMenu();

        copyItem = new JMenuItem("Copy and create a new package");
        copyItem.addActionListener(
            new ActionListener() {

              @Override
              public void actionPerformed(ActionEvent e) {
                copyAndCreate(tblPackages.getSelectedRow());
              }
            });
        JMenuItem deleteItem = new JMenuItem("Delete");
        deleteItem.addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                btnDeleteMouseClicked(null);
              }
            });

        JMenuItem newItem = new JMenuItem("New");
        newItem.addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                addNewRow();
              }
            });
        JMenuItem editItem = new JMenuItem("Edit");
        editItem.addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                btnEditMouseClicked(null);
              }
            });
        JMenuItem saveItem = new JMenuItem("Save");
        saveItem.addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                btnSaveMouseClicked(null);
              }
            });
        JMenuItem printItem = new JMenuItem("Print");
        printItem.addActionListener(
            new ActionListener() {

              @Override
              public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                try {
                  // openURL("http://google.com");
                  openURL("http://localhost:8081/CrystalWeb2/PackageList.rpt-viewer.jsp");
                } catch (RuntimeException e1) {
                  TXLogger.logger.error(e1.getMessage());
                  // e1.printStackTrace();
                } catch (IOException e2) {
                  TXLogger.logger.error(e2.getMessage());
                  // e2.printStackTrace();
                }
              }
            });
        popupMenu.add(copyItem);
        popupMenu.addSeparator();
        popupMenu.add(deleteItem);
        popupMenu.add(saveItem);
        popupMenu.add(editItem);
        popupMenu.add(newItem);
        popupMenu.addSeparator();
        popupMenu.add(printItem);
      }
    }
    {
      cmbProdFilterModel = new DefaultComboBoxModel();
      cmbProdFilter = new JComboBox();
      getContentPane().add(cmbProdFilter);
      cmbProdFilter.setModel(cmbProdFilterModel);
      cmbProdFilter.setBounds(436, 283, 204, 21);
      cmbProdFilter.setEditable(true);
      cmbProdFilter.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
              cmbProdFilterItemStateChanged(evt);
            }
          });
    }
    {
      jLabel1 = new JLabel();
      getContentPane().add(jLabel1);
      jLabel1.setBounds(33, 9, 129, 14);
      jLabel1.setName("jLabel1");
    }
    {
      jLabel2 = new JLabel();
      getContentPane().add(jLabel2);
      jLabel2.setBounds(34, 248, 94, 14);
      jLabel2.setName("jLabel2");
    }
    {
      jLabel3 = new JLabel();
      getContentPane().add(jLabel3);
      jLabel3.setBounds(436, 248, 119, 14);
      jLabel3.setName("jLabel3");
    }
    {
      btnInc = new JButton("<");
      getContentPane().add(btnInc);
      btnInc.setBounds(351, 327, 52, 21);
      btnInc.setName("btnInc");
      btnInc.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent evt) {
              TXLogger.logger.debug("btnInc.mouseClicked, event");
              // System.out.println("btnInc.mouseClicked, event=" + evt);
              btnIncMouseClicked(evt);
            }
          });
    }
    {
      btnIncAll = new JButton("<<");
      getContentPane().add(btnIncAll);
      btnIncAll.setBounds(351, 362, 52, 21);
      btnIncAll.setName("btnIncAll");
      btnIncAll.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent evt) {
              btnIncAllMouseClicked(evt);
            }
          });
    }
    {
      btnExc = new JButton(">");
      getContentPane().add(btnExc);
      btnExc.setBounds(351, 394, 52, 21);
      btnExc.setName("btnExc");
      btnExc.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent evt) {
              btnExcMouseClicked(evt);
            }
          });
    }
    {
      btnExcAll = new JButton(">>");
      getContentPane().add(btnExcAll);
      btnExcAll.setBounds(351, 426, 52, 21);
      btnExcAll.setName("btnExcAll");
      btnExcAll.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent evt) {
              btnExcAllMouseClicked(evt);
            }
          });
    }
    {
      jScrollPane3 = new JScrollPane();
      getContentPane().add(jScrollPane3);
      jScrollPane3.setBounds(437, 306, 286, 169);
      {
        ListModel jList1Model = new DefaultComboBoxModel(new String[] {"Item One", "Item Two"});
        lstProdAvi =
            new JList(new Object[] {"First Class Flight", "Car Rental", "Scuba Diving Adventure"});
        jScrollPane3.setViewportView(lstProdAvi);
        lstProdAvi.setModel(jList1Model);
        lstProdAvi.setBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createBevelBorder(1), "Product--Supplier"));
        lstProdAvi.setBounds(436, 284, 286, 169);
        dlmAvi = new DefaultListModel();
        lstProdAvi.setModel(dlmAvi);
      }
    }
    {
      jScrollPane2 = new JScrollPane();
      getContentPane().add(jScrollPane2);
      getContentPane().add(getJLabel4());
      getContentPane().add(getJLabel5());
      getContentPane().add(getJLabel7());
      getContentPane().add(getCmbPkgFilter());
      getContentPane().add(getJLabel8());
      getContentPane().add(getJLabel6());
      getContentPane().add(getCmbOrderBy());
      jScrollPane2.setBounds(34, 303, 286, 166);
      jScrollPane2.setViewportView(lstProdInc);
    }
    // Draw fancy border for the list
    lstProdInc.setBorder(
        BorderFactory.createTitledBorder(BorderFactory.createBevelBorder(1), "Product--Supplier"));
    lstProdInc.setBounds(33, 281, 286, 166);
    lstProdInc.setModel(dlmInc);
    validate();
    pack();
    Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this);
    getAllProdList("");
    initCboProdFilter();
    tblPackages.getColumn(pkgTblModel.getColumnName(0)).setPreferredWidth(15);
    tblPackages.getColumn(pkgTblModel.getColumnName(1)).setPreferredWidth(100);
    tblPackages.getColumn(pkgTblModel.getColumnName(2)).setPreferredWidth(40);
    tblPackages.getColumn(pkgTblModel.getColumnName(3)).setPreferredWidth(40);
    tblPackages.getColumn(pkgTblModel.getColumnName(4)).setPreferredWidth(200);
    tblPackages.getColumn(pkgTblModel.getColumnName(5)).setPreferredWidth(40);
    tblPackages.getColumn(pkgTblModel.getColumnName(6)).setPreferredWidth(40);
    tblPackages.setName("tblPackages");
    setButtonState(false);
  }
Пример #25
0
  /** Create the frame. */
  public AdminUserControl() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 572, 387);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    list = new JList(listModel);
    list.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent arg0) {
            int i = list.getSelectedIndex();
            firstnameField.setText(users.get(i).first_name);
            lastnameField.setText(users.get(i).last_name);
            emailField.setText(users.get(i).email);
            phoneField.setText(users.get(i).phonenumber);

            if (users.get(i).admin_status == 1) {
              adminCheckBox.setSelected(true);
            } else {
              adminCheckBox.setSelected(false);
            }
          }
        });

    list.setBounds(25, 30, 184, 272);
    contentPane.add(list);
    users = DB.getAllUsers();
    for (int i = 0; i < users.size(); i++) {
      listModel.addElement(users.get(i).getName() + " (" + users.get(i).email + ")");
    }

    firstnameField = new JTextField();
    firstnameField.setBounds(390, 30, 99, 20);
    contentPane.add(firstnameField);
    firstnameField.setColumns(10);

    lastnameField = new JTextField();
    lastnameField.setBounds(390, 61, 99, 20);
    contentPane.add(lastnameField);
    lastnameField.setColumns(10);

    emailField = new JTextField();
    emailField.setBounds(390, 92, 99, 20);
    contentPane.add(emailField);
    emailField.setColumns(10);

    JLabel lblNewLabel = new JLabel("F\u00F6rnamn:");
    lblNewLabel.setBounds(310, 33, 83, 14);
    contentPane.add(lblNewLabel);

    JLabel lblNewLabel_1 = new JLabel("Efternamn:");
    lblNewLabel_1.setBounds(310, 64, 83, 14);
    contentPane.add(lblNewLabel_1);

    JLabel lblNewLabel_2 = new JLabel("E-mail:");
    lblNewLabel_2.setBounds(310, 95, 61, 14);
    contentPane.add(lblNewLabel_2);

    JLabel lblAdminStatus = new JLabel("Adminstatus:");
    lblAdminStatus.setBounds(310, 162, 83, 14);
    contentPane.add(lblAdminStatus);

    JLabel lblAccounts = new JLabel("V\u00E4lj Konto");
    lblAccounts.setBounds(89, 11, 61, 14);
    contentPane.add(lblAccounts);

    JButton btnUppdatera = new JButton("Uppdatera");
    btnUppdatera.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            EmailValidator emailValidator = new EmailValidator();
            PhoneValidator phoneValidator = new PhoneValidator();
            int i = list.getSelectedIndex();
            if (i >= 0) {
              User user = users.get(i);
              int adminStatus = 0;
              if (adminCheckBox.isSelected()) {
                adminStatus = 1;
              } else if (adminCheckBox.isSelected() == false) {
                adminStatus = 0;
              }
              if (!emailValidator.validate(emailField.getText().trim())) {
                JOptionPane.showMessageDialog(null, "Du måste ange en giltlig Email");
                emailField.setBackground(Color.red);
                /*
                   Action that you want to take. For ex. make email id field red
                   or give message box saying invalid email id.
                */
              } else if (!phoneValidator.validate(phoneField.getText().trim())) {
                JOptionPane.showMessageDialog(null, "Du måste ange ett Telefonnummer");
                phoneField.setBackground(Color.red);
              } else {
                String ret =
                    DB.UpdateUser(
                        user.id,
                        emailField.getText(),
                        firstnameField.getText(),
                        lastnameField.getText(),
                        phoneField.getText(),
                        adminStatus);
                JOptionPane.showMessageDialog(null, ret);
                AdminUserControl reload = new AdminUserControl();
                AdminUserControl.this.dispose();
                reload.setVisible(true);
              }
            } else {
              JOptionPane.showMessageDialog(null, "Du måste välja en användare!");
            }
          }
        });
    btnUppdatera.setBounds(390, 215, 99, 23);
    contentPane.add(btnUppdatera);

    adminCheckBox = new JCheckBox("");
    adminCheckBox.setBounds(390, 158, 97, 23);
    contentPane.add(adminCheckBox);

    JButton btnTaBort = new JButton("Ta bort");
    btnTaBort.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            int i = list.getSelectedIndex();
            if (i >= 0) {
              User user = users.get(i);
              String ret = DB.RemoveUser(user.id);
              JOptionPane.showMessageDialog(null, ret);
              AdminUserControl reload = new AdminUserControl();
              AdminUserControl.this.dispose();
              reload.setVisible(true);
            } else {
              JOptionPane.showMessageDialog(null, "Du måste välja en användare!");
            }
          }
        });
    btnTaBort.setBounds(390, 245, 99, 23);
    contentPane.add(btnTaBort);

    JButton btnNyttKonto = new JButton("Nytt konto");
    btnNyttKonto.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            AddUserAdmin Adduser = new AddUserAdmin();
            Adduser.setVisible(true);
            setVisible(false);
          }
        });
    btnNyttKonto.setBounds(390, 279, 99, 23);
    contentPane.add(btnNyttKonto);

    phoneField = new JTextField();
    phoneField.setBounds(390, 123, 99, 20);
    contentPane.add(phoneField);
    phoneField.setColumns(10);

    JLabel lblTelefonnr = new JLabel("Telefonnr:");
    lblTelefonnr.setBounds(310, 126, 65, 14);
    contentPane.add(lblTelefonnr);

    Scrollbar scrollbar = new Scrollbar();
    scrollbar.setBounds(192, 30, 17, 272);
    contentPane.add(scrollbar);

    JButton btnTillbaka = new JButton("Tillbaka");
    btnTillbaka.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            AdminMenu menu = new AdminMenu();
            menu.setVisible(true);
            setVisible(false);
          }
        });
    btnTillbaka.setBounds(265, 315, 89, 23);
    contentPane.add(btnTillbaka);
  }
Пример #26
0
 private void init(b3financialstaffui b3financialstaffui) {
   documentController = new documentController();
   Font font = new Font("幼圆", Font.BOLD, 20);
   yesButton = new JButton(yesIcon);
   yesButton.setBounds(602, 575, 48, 48);
   yesButton.setContentAreaFilled(false);
   returnButton = new JButton(returnIcon);
   returnButton.setBounds(662, 575, 48, 48);
   returnButton.setContentAreaFilled(false);
   bianhaoJLabel = new JLabel("付款单编号:");
   bianhaoJLabel.setForeground(Color.white);
   bianhaoJLabel.setFont(font);
   bianhaoJLabel.setBounds(50, 50, 150, 30);
   bianhaonumberJLabel = new JLabel();
   try {
     bianhaonumberJLabel.setText(documentController.getDocCode("付款单", account));
   } catch (RemoteException e) {
     // TODO Auto-generated catch block
     new InternetDialog(b3financialstaffui);
   }
   bianhaonumberJLabel.setForeground(Color.white);
   bianhaonumberJLabel.setFont(font);
   bianhaonumberJLabel.setBounds(200, 50, 150, 30);
   riqiJLabel = new JLabel("付款日期:");
   riqiJLabel.setForeground(Color.white);
   riqiJLabel.setFont(font);
   riqiJLabel.setBounds(50, 150, 150, 30);
   Date now = new Date();
   SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
   riqi = new JLabel(dateFormat.format(now));
   riqi.setFont(font);
   riqi.setForeground(Color.white);
   riqi.setBounds(150, 150, 210, 30);
   fukuanrenxingmingJLabel = new JLabel("付款人姓名:");
   fukuanrenxingmingJLabel.setForeground(Color.white);
   fukuanrenxingmingJLabel.setFont(font);
   fukuanrenxingmingJLabel.setBounds(50, 250, 150, 30);
   fukuanrenxingmingField = new JTextField();
   fukuanrenxingmingField.setFont(font);
   fukuanrenxingmingField.setBounds(200, 250, 150, 30);
   danjumingJLabel = new JLabel("单据名:");
   danjumingJLabel.setForeground(Color.white);
   danjumingJLabel.setFont(font);
   danjumingJLabel.setBounds(370, 50, 150, 30);
   danjuming = new JLabel("付款单");
   danjuming.setFont(font);
   danjuming.setForeground(Color.white);
   danjuming.setBounds(500, 50, 150, 30);
   jineJLabel = new JLabel("付款金额:");
   jineJLabel.setForeground(Color.white);
   jineJLabel.setFont(font);
   jineJLabel.setBounds(370, 150, 150, 30);
   jineField = new JTextField();
   jineField.setFont(font);
   jineField.setBounds(500, 150, 150, 30);
   zhanghaoJLabel = new JLabel("付款账户:");
   zhanghaoJLabel.setForeground(Color.white);
   zhanghaoJLabel.setFont(font);
   zhanghaoJLabel.setBounds(370, 250, 150, 30);
   zhanghaoField = new JTextField();
   zhanghaoField.setFont(font);
   zhanghaoField.setBounds(500, 250, 150, 30);
   beizhuJLabel = new JLabel("备注:");
   beizhuJLabel.setForeground(Color.white);
   beizhuJLabel.setFont(font);
   beizhuJLabel.setBounds(370, 350, 150, 30);
   tiaomuJLabel = new JLabel("条目:");
   tiaomuJLabel.setForeground(Color.white);
   tiaomuJLabel.setFont(font);
   tiaomuJLabel.setBounds(50, 350, 150, 30);
   DefaultListModel tiaomulistModel = new DefaultListModel();
   tiaomulistModel.addElement("租金(按年收)");
   tiaomulistModel.addElement("运费(按次计算)");
   tiaomulistModel.addElement("人员工资(按月统计)");
   tiaomulistModel.addElement("奖励(一次性)");
   DefaultListModel beizhulistModel = new DefaultListModel();
   beizhulistModel.addElement("租金年份");
   beizhulistModel.addElement("运单号");
   beizhulistModel.addElement("工资月份");
   beizhulistModel.addElement("快递员提成");
   beizhulistModel.addElement("司机计次");
   beizhulistModel.addElement("业务员月薪");
   tiaomuJList = new JList<String>(tiaomulistModel);
   tiaomuJList.setBounds(150, 350, 200, 100);
   tiaomuJList.setFont(font);
   tiaomuJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   beizhuJList = new JList<String>(beizhulistModel);
   beizhuJList.setBounds(500, 350, 150, 150);
   beizhuJList.setFont(font);
   beizhuJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   this.add(bianhaoJLabel);
   this.add(bianhaonumberJLabel);
   this.add(riqiJLabel);
   this.add(riqi);
   this.add(fukuanrenxingmingJLabel);
   this.add(fukuanrenxingmingField);
   this.add(danjumingJLabel);
   this.add(danjuming);
   this.add(jineField);
   this.add(jineJLabel);
   this.add(zhanghaoField);
   this.add(zhanghaoJLabel);
   this.add(beizhuJLabel);
   this.add(tiaomuJLabel);
   this.add(tiaomuJList);
   this.add(beizhuJList);
   this.setBounds(260, 60, 730, 650);
   this.add(yesButton);
   this.add(returnButton);
   this.setLayout(null);
   this.setOpaque(false);
 }
Пример #27
0
  // skapar alla grafiska komponenter
  private void initComponents() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 1241, 589);
    setContentPane(contentPane);

    studentList.setBounds(12, 13, 314, 419);
    courseList.setBounds(12, 13, 314, 387);
    addStudentButton.setBounds(87, 448, 152, 25);
    tabbedPane.setBounds(12, 13, 343, 516);
    addCourseButton.setBounds(186, 431, 124, 41);
    highestFlowButton.setBounds(12, 424, 124, 48);

    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(null);
    contentPane.add(tabbedPane);

    tabbedPane.addTab("Studenter", null, studentTabPanel, null);
    tabbedPane.addTab("Kurser", null, courseTabPanel, null);

    studentTabPanel.setLayout(null);
    studentTabPanel.add(studentList);
    studentTabPanel.add(addStudentButton);

    courseTabPanel.setLayout(null);
    courseTabPanel.add(courseList);
    courseTabPanel.add(addCourseButton);
    courseTabPanel.add(highestFlowButton);
    highestFlowButton.setText(
        "<html><center>" + "Kurs med störst" + "<br>" + "genomströmning" + "</center></html>");

    highestFlowButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            showHighestFlow();
          }
        });

    addStudentButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            addStudent();
          }
        });

    addCourseButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            addCourse();
          }
        });

    studentList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            studentList_valueChanged(e);
          }
        });

    courseList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            courseList_valueChanged(e);
          }
        });
  }