コード例 #1
0
  private void CreateWindow() {
    fm = new Param(new File("graph.pref"));
    FilePath = fm.getDefaultPath(new File("Graph.ini"));

    JMenuBar menubar = new JMenuBar();

    JMenu MenuFile = new JMenu("File");

    menubar.add(MenuFile);

    JMenuItem MenuNew = new JMenuItem(Param.Label_File_New);
    JMenuItem MenuOpen = new JMenuItem(Param.Label_File_Open);
    JMenuItem MenuSave = new JMenuItem(Param.Label_File_Save);
    JMenuItem MenuQuit = new JMenuItem(Param.Label_File_Quit);

    MenuFile.add(MenuNew);
    MenuFile.add(MenuOpen);
    MenuFile.add(MenuSave);
    MenuFile.add(MenuQuit);

    MenuNew.addActionListener(this);
    MenuOpen.addActionListener(this);
    MenuSave.addActionListener(this);
    MenuQuit.addActionListener(this);

    initParam();

    tabCom = new ComSetting();
    tabSubGHz = new SubghzSetting();

    SettingFrame = new JTabbedPane();
    SettingFrame.addTab("COM", tabCom);
    SettingFrame.addTab("SubGHz", tabSubGHz);
    SettingFrame.setBounds(0, 0, 600, 200);
    SettingFrame.setEnabledAt(1, Param.Subghz_Tab_Enb);

    graphSetting = new GraphSetting();

    graphStart = new JButton(Param.Label_Start);
    graphStart.addActionListener(this);

    setLayout(null);

    graphSetting.setBounds(0, 0, 600, 200);
    graphStart.setBounds(240, 210, 100, 30);
    SettingFrame.setBounds(0, 240, 600, 200);

    add(SettingFrame);
    add(graphSetting);
    add(graphStart);

    setTitle("Setting Window");
    setJMenuBar(menubar);
    setBounds(100, 100, 600, 480);

    ImageIcon icon = new ImageIcon(Param.App_Icon);
    setIconImage(icon.getImage());
  }
コード例 #2
0
ファイル: ViewOperateUI.java プロジェクト: Goldenbullet/Code
  public ViewOperateUI(MainUIService main) {
    setLayout(null);
    m = main;
    this.setBounds(0, 0, 850, 700);
    this.setBackground(Color.WHITE);
    Font font2 = new Font("楷体", Font.BOLD, 18);

    JLabel title = new JLabel("经 营 状 态 表");
    title.setBounds(320, 30, 200, 40);
    title.setFont(font2);
    this.add(title);

    tabpane = new JTabbedPane(JTabbedPane.TOP);
    initPanelList();
    tabpane.setBounds(50, 80, tablewidth, tableheight);
    this.add(tabpane);

    Listener listen = new Listener();

    excel = new JButton("导出到Excel");
    excel.setBounds(250, 620, 150, 40);
    excel.setVisible(true);
    excel.setFont(new Font("隶书", Font.PLAIN, 20));
    excel.addMouseListener(listen);
    this.add(excel);

    exit = new JButton("返回");
    exit.setBounds(430, 620, 150, 40);
    exit.setVisible(true);
    exit.setFont(new Font("隶书", Font.PLAIN, 20));
    exit.addMouseListener(listen);
    this.add(exit);
  }
コード例 #3
0
  /**
   * Crea i tab dell'analisi di un file
   *
   * @param s stringhe contenenti le path all'analisi del file scelto
   * @param al ArrayList contenenti i termini rilevanti del file
   */
  public void createTabFile(String[] s, ArrayList<String> al) {
    if (s == null || al == null) return;

    tabFile = new JTabbedPane();
    tabFile.setBounds(0, 0, 1100, 612);

    for (int i = 0; i < 4; i++) {
      switch (i) {
        case 0:
          {
            tabFile.addTab("Text to analyze", getTabTextFile(s[0], al));
            break;
          }
        case 1:
          {
            tabFile.addTab("Sentence splitting", getTabHTMLFile(s[1]));
            break;
          }
        case 2:
          {
            tabFile.addTab("Term extraction", getTabHTMLFile(s[2]));
            break;
          }
        case 3:
          {
            tabFile.addTab("Annotation", getTabHTMLFile(s[3]));
            break;
          }
      }
    }
    panelAnalysis.removeAll();
    panelAnalysis.add(tabFile);
  }
コード例 #4
0
 TabPanel() {
   tabPane = new JTabbedPane();
   this.add(tabPane);
   tabPane.setBounds(0, 0, 631, 630);
   tabPane.addTab("会员信息", icon_info, membPane);
   tabPane.addTab("流水管理", icon_order, busiPane);
   tabPane.addTab("财务状态", icon_order, finaPane);
   tabPane.setFont(font);
 }
コード例 #5
0
 /**
  * This method initializes tabPaciente
  *
  * @return javax.swing.JTabbedPane
  */
 private JTabbedPane getTabPaciente() {
   if (tabPaciente == null) {
     tabPaciente = new JTabbedPane();
     tabPaciente.setBounds(new Rectangle(1, 3, 526, 511));
     tabPaciente.addTab("Datos Paciente", null, getPanelDoctor(), null);
     tabPaciente.addTab("Historia Medica", null, getPanelRecord(), null);
   }
   return tabPaciente;
 }
コード例 #6
0
  /**
   * The GPropertiesDialog class constructor.
   *
   * @param gui the GUI class
   */
  public GPropertiesDialog(GUI gui) {
    // superclass constructor
    super(gui, "Properties", false);
    objects = new ObjectContainer();

    // gui
    this.gui = gui;

    // set the fixed size
    setSize(260, 350);
    setResizable(false);
    setLayout(null);

    // set up panels for stuff
    pane = new JTabbedPane();

    // add the tabbed panel
    tabbedPanePanel = new JPanel();
    tabbedPanePanel.add(pane);
    tabbedPanePanel.setLayout(null);
    this.getContentPane().add(tabbedPanePanel);
    tabbedPanePanel.setBounds(0, 0, this.getWidth(), 280);
    pane.setBounds(0, 0, tabbedPanePanel.getWidth(), tabbedPanePanel.getHeight());

    // set up buttons
    apply = new JButton("Apply");
    apply.setBounds(150, 290, 80, 26);
    this.getContentPane().add(apply);

    close = new JButton("Close");
    close.setBounds(50, 290, 80, 26);
    this.getContentPane().add(close);

    addPanel(new GPropertiesPanelCustomObject(gui.getGMap()), "Object");

    // add listeners
    addMouseListener(this);
    apply.addItemListener(this);
    apply.addActionListener(this);
    close.addItemListener(this);
    close.addActionListener(this);
  }
コード例 #7
0
  private void initJTabbedPane() {
    // JTablePanel

    onglets = new JTabbedPane(SwingConstants.TOP);
    onglets.setBackground(new Color(218, 202, 251));

    // Veinoisserie
    onglet1 = new JPanel();
    onglet1.setBorder(new LineBorder(new Color(0, 0, 0)));
    onglet1.setBackground(new Color(218, 202, 251));
    onglet1.setPreferredSize(new Dimension(300, 80));
    onglets.addTab("Vienoisserie", onglet1);
    listeVeinoisserie(onglet1);

    // Boisson
    onglet2 = new JPanel();
    onglet2.setBorder(new LineBorder(new Color(0, 0, 0)));
    onglet2.setBackground(new Color(218, 202, 251));
    onglets.addTab("Boisson", onglet2);
    listeBoisson(onglet2);

    onglets.setBounds(22, 67, 300, 600);
    contentPane.add(onglets);
  }
コード例 #8
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setResizable(false);
    frame.setBounds(100, 100, 505, 467);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);
    frame.setLocationRelativeTo(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 0, 500, 442);

    /*Camera Report Panel*/
    CameraReportPanel = new JPanel();
    tabbedPane.add("Camera Report", CameraReportPanel);
    tabbedPane.setEnabledAt(0, true);
    CameraReportPanel.setLayout(null);

    JLabel label = new JLabel("Insert First Part of IP (xxx.xxx.xxx):");
    label.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label.setBounds(36, 40, 232, 25);
    CameraReportPanel.add(label);

    JLabel label_1 = new JLabel("Insert Starting Host Number:");
    label_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_1.setBounds(36, 72, 181, 17);
    CameraReportPanel.add(label_1);

    JLabel label_2 = new JLabel("Insert Ending Host Number:");
    label_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_2.setBounds(36, 112, 181, 17);
    CameraReportPanel.add(label_2);

    sOctet = new JTextField();
    sOctet.setFont(new Font("Dialog", Font.PLAIN, 20));
    sOctet.addFocusListener(this);
    sOctet.setColumns(10);
    sOctet.setBounds(278, 70, 40, 25);
    CameraReportPanel.add(sOctet);

    eOctet = new JTextField();
    eOctet.setFont(new Font("Dialog", Font.PLAIN, 20));
    eOctet.addFocusListener(this);
    eOctet.setColumns(10);
    eOctet.setBounds(278, 110, 40, 25);
    CameraReportPanel.add(eOctet);

    JLabel label_3 = new JLabel("Enter Username:"******"Tahoma", Font.PLAIN, 14));
    label_3.setBounds(36, 205, 106, 14);
    CameraReportPanel.add(label_3);

    JLabel label_4 = new JLabel("Enter Password:"******"Tahoma", Font.PLAIN, 14));
    label_4.setBounds(36, 249, 106, 14);
    CameraReportPanel.add(label_4);

    uName = new JTextField();
    uName.setFont(new Font("Tahoma", Font.PLAIN, 19));
    uName.addFocusListener(this);
    uName.setText("root");
    uName.setColumns(10);
    uName.setBounds(143, 195, 149, 32);
    CameraReportPanel.add(uName);

    passwordField = new JPasswordField();
    passwordField.setFont(new Font("Tahoma", Font.PLAIN, 19));
    passwordField.addFocusListener(this);
    passwordField.setText("p@ssw0rd");
    passwordField.setBounds(143, 239, 149, 32);
    CameraReportPanel.add(passwordField);

    checkBoxPing = new JCheckBox("Ping Address");
    checkBoxPing.setFont(new Font("Tahoma", Font.PLAIN, 14));
    checkBoxPing.setSelected(true);
    checkBoxPing.setBounds(36, 144, 125, 23);
    CameraReportPanel.add(checkBoxPing);

    progressBar = new JProgressBar();
    progressBar.setString("");
    progressBar.setStringPainted(true);
    progressBar.setBounds(68, 331, 374, 32);
    CameraReportPanel.add(progressBar);

    CamReportBtn = new JButton("Run");
    CamReportBtn.addActionListener(this);
    CamReportBtn.setBounds(201, 282, 104, 38);
    CameraReportPanel.add(CamReportBtn);

    firstOctet = new JTextField();
    firstOctet.addFocusListener(this);
    firstOctet.setFont(new Font("Tahoma", Font.PLAIN, 20));
    firstOctet.setText("10");
    firstOctet.setColumns(3);
    firstOctet.setBounds(278, 38, 40, 25);
    CameraReportPanel.add(firstOctet);

    secondOctet = new JTextField();
    secondOctet.addFocusListener(this);
    secondOctet.setFont(new Font("Dialog", Font.PLAIN, 20));
    secondOctet.setColumns(3);
    secondOctet.setBounds(328, 37, 40, 25);
    CameraReportPanel.add(secondOctet);

    thirdOctet = new JTextField();
    thirdOctet.addFocusListener(this);
    thirdOctet.setFont(new Font("Dialog", Font.PLAIN, 20));
    thirdOctet.setColumns(3);
    thirdOctet.setBounds(378, 37, 40, 25);
    CameraReportPanel.add(thirdOctet);

    JLabel label_5 = new JLabel(".");
    label_5.setFont(new Font("Dialog", Font.BOLD, 17));
    label_5.setBounds(320, 50, 4, 14);
    CameraReportPanel.add(label_5);

    JLabel label_6 = new JLabel(".");
    label_6.setFont(new Font("Dialog", Font.BOLD, 17));
    label_6.setBounds(370, 50, 4, 14);
    CameraReportPanel.add(label_6);

    /*Host Uploader Panel*/
    frame.getContentPane().add(tabbedPane);
    JComponent HostUploaderPanel = new JPanel();
    tabbedPane.add("Host Uploader", HostUploaderPanel);
    tabbedPane.setEnabledAt(1, true);
    HostUploaderPanel.setLayout(null);

    hostUploaderBrowseBtn = new JButton("Browse");
    hostUploaderBrowseBtn.addActionListener(this);
    hostUploaderBrowseBtn.setBounds(23, 82, 117, 29);
    HostUploaderPanel.add(hostUploaderBrowseBtn);

    filePath = new JTextField();
    filePath.addFocusListener(this);
    filePath.setFont(new Font("Tahoma", Font.PLAIN, 10));
    filePath.setBounds(150, 86, 318, 20);
    HostUploaderPanel.add(filePath);
    filePath.setColumns(10);

    hostUploaderRunBtn = new JButton("Run");
    hostUploaderRunBtn.setFont(new Font("Tahoma", Font.PLAIN, 15));
    hostUploaderRunBtn.addActionListener(this);
    hostUploaderRunBtn.setBounds(157, 334, 186, 60);
    hostUploaderRunBtn.setEnabled(false);
    HostUploaderPanel.add(hostUploaderRunBtn);

    JLabel label_7 = new JLabel("Insert First Part of IP (xxx.xxx.xxx):");
    label_7.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_7.setBounds(23, 125, 232, 25);
    HostUploaderPanel.add(label_7);

    textField_7 = new JTextField();
    textField_7.addFocusListener(this);
    textField_7.setText("10");
    textField_7.setFont(new Font("Tahoma", Font.PLAIN, 20));
    textField_7.setColumns(3);
    textField_7.setBounds(265, 123, 40, 25);
    HostUploaderPanel.add(textField_7);

    textField_8 = new JTextField();
    textField_8.addFocusListener(this);
    textField_8.setFont(new Font("Dialog", Font.PLAIN, 20));
    textField_8.setColumns(3);
    textField_8.setBounds(315, 122, 40, 25);
    HostUploaderPanel.add(textField_8);

    textField_9 = new JTextField();
    textField_9.addFocusListener(this);
    textField_9.setFont(new Font("Dialog", Font.PLAIN, 20));
    textField_9.setColumns(3);
    textField_9.setBounds(365, 122, 40, 25);
    HostUploaderPanel.add(textField_9);

    JLabel label_8 = new JLabel("Insert Starting Host Number:");
    label_8.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_8.setBounds(23, 157, 181, 17);
    HostUploaderPanel.add(label_8);

    textField_10 = new JTextField();
    textField_10.addFocusListener(this);
    textField_10.setFont(new Font("Dialog", Font.PLAIN, 20));
    textField_10.setColumns(10);
    textField_10.setBounds(265, 155, 40, 25);
    HostUploaderPanel.add(textField_10);

    JLabel label_9 = new JLabel("Insert Ending Host Number:");
    label_9.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_9.setBounds(23, 197, 181, 17);
    HostUploaderPanel.add(label_9);

    textField_11 = new JTextField();
    textField_11.addFocusListener(this);
    textField_11.setFont(new Font("Dialog", Font.PLAIN, 20));
    textField_11.setColumns(10);
    textField_11.setBounds(265, 195, 40, 25);
    HostUploaderPanel.add(textField_11);

    JLabel label_10 = new JLabel("Enter Username:"******"Tahoma", Font.PLAIN, 14));
    label_10.setBounds(23, 265, 106, 14);
    HostUploaderPanel.add(label_10);

    textField_12 = new JTextField();
    textField_12.addFocusListener(this);
    textField_12.setText("root");
    textField_12.setFont(new Font("Tahoma", Font.PLAIN, 19));
    textField_12.setColumns(10);
    textField_12.setBounds(130, 255, 149, 32);
    HostUploaderPanel.add(textField_12);

    JLabel label_11 = new JLabel("Enter Password:"******"Tahoma", Font.PLAIN, 14));
    label_11.setBounds(23, 309, 106, 14);
    HostUploaderPanel.add(label_11);

    passwordField_1 = new JPasswordField();
    passwordField_1.addFocusListener(this);
    passwordField_1.setText("p@ssw0rd");
    passwordField_1.setFont(new Font("Tahoma", Font.PLAIN, 19));
    passwordField_1.setBounds(130, 291, 149, 32);
    HostUploaderPanel.add(passwordField_1);

    JLabel lblNewLabel = new JLabel("NOTE: Running this program REBOOTS the Camera(s)");
    lblNewLabel.setForeground(Color.RED);
    lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18));
    lblNewLabel.setBounds(23, 17, 445, 54);
    HostUploaderPanel.add(lblNewLabel);

    JLabel label_12 = new JLabel(".");
    label_12.setFont(new Font("Dialog", Font.BOLD, 17));
    label_12.setBounds(308, 132, 4, 14);
    HostUploaderPanel.add(label_12);

    JLabel label_13 = new JLabel(".");
    label_13.setFont(new Font("Dialog", Font.BOLD, 17));
    label_13.setBounds(358, 132, 4, 14);
    HostUploaderPanel.add(label_13);
    JComponent snmpReportPanel = new JPanel();
    tabbedPane.add("SNMP Report", snmpReportPanel);
    tabbedPane.setEnabledAt(2, true);
  }
コード例 #9
0
  /** Create the frame. */
  public TelaResultados(Apostador apostador1) {
    this.apostador = apostador1;
    setTitle("Resultados");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 796, 476);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 53, 575, 324);
    contentPane.add(tabbedPane);
    // este construtor possui praticamente a mesma coisa da Tela APostas
    ArrayList<Integer> listaDoGrupoA = new ArrayList<Integer>();
    ArrayList<Integer> listaDoGrupoB = new ArrayList<Integer>();
    ArrayList<Integer> listaDoGrupoC = new ArrayList<Integer>();
    ArrayList<Integer> listaDoGrupoD = new ArrayList<Integer>();
    ArrayList<Integer> listaDoGrupoE = new ArrayList<Integer>();
    ArrayList<Integer> listaDoGrupoF = new ArrayList<Integer>();
    ArrayList<Integer> listaDoGrupoG = new ArrayList<Integer>();
    ArrayList<Integer> listaDoGrupoH = new ArrayList<Integer>();
    for (int i = 0; i < ListaTimes.getListaTimes().length; i++) {
      if (ListaTimes.getListaTimes()[i].getGrupo().equals("A")) {
        listaDoGrupoA.add(i);
      } else if (ListaTimes.getListaTimes()[i].getGrupo().equals("B")) {
        listaDoGrupoB.add(i);
      } else if (ListaTimes.getListaTimes()[i].getGrupo().equals("C")) {
        listaDoGrupoC.add(i);
      } else if (ListaTimes.getListaTimes()[i].getGrupo().equals("D")) {
        listaDoGrupoD.add(i);
      } else if (ListaTimes.getListaTimes()[i].getGrupo().equals("E")) {
        listaDoGrupoE.add(i);
      } else if (ListaTimes.getListaTimes()[i].getGrupo().equals("F")) {
        listaDoGrupoF.add(i);
      } else if (ListaTimes.getListaTimes()[i].getGrupo().equals("G")) {
        listaDoGrupoG.add(i);
      } else if (ListaTimes.getListaTimes()[i].getGrupo().equals("H")) {
        listaDoGrupoH.add(i);
      }
    }
    // cada panel receberá uma instância de FrameApostas, onde terá 5 parâmetros
    // esses parâmetros são necessários para configurarmos o Grupo onde cada time vai participar.
    // o apostador sempre será passado como parâmetro
    this.panel =
        new PanelResultados(
            ListaTimes.getListaTimes()[listaDoGrupoA.get(0)],
            ListaTimes.getListaTimes()[listaDoGrupoA.get(1)],
            ListaTimes.getListaTimes()[listaDoGrupoA.get(2)],
            ListaTimes.getListaTimes()[listaDoGrupoA.get(3)],
            apostador,
            0);
    // neste caso, também passamos o id do jogo. Ele será de suma importância na comparação dos
    // jogos e das apostas
    tabbedPane.addTab("Grupo A", null, panel, null);
    panel.setLayout(null);

    this.panel_1 =
        new PanelResultados(
            ListaTimes.getListaTimes()[listaDoGrupoB.get(0)],
            ListaTimes.getListaTimes()[listaDoGrupoB.get(1)],
            ListaTimes.getListaTimes()[listaDoGrupoB.get(2)],
            ListaTimes.getListaTimes()[listaDoGrupoB.get(3)],
            apostador,
            6);
    tabbedPane.addTab("Grupo B", null, panel_1, null);

    this.panel_2 =
        new PanelResultados(
            ListaTimes.getListaTimes()[listaDoGrupoC.get(0)],
            ListaTimes.getListaTimes()[listaDoGrupoC.get(1)],
            ListaTimes.getListaTimes()[listaDoGrupoC.get(2)],
            ListaTimes.getListaTimes()[listaDoGrupoC.get(3)],
            apostador,
            12);
    tabbedPane.addTab("Grupo C", null, panel_2, null);

    this.panel_3 =
        new PanelResultados(
            ListaTimes.getListaTimes()[listaDoGrupoD.get(0)],
            ListaTimes.getListaTimes()[listaDoGrupoD.get(1)],
            ListaTimes.getListaTimes()[listaDoGrupoD.get(2)],
            ListaTimes.getListaTimes()[listaDoGrupoD.get(3)],
            apostador,
            18);
    tabbedPane.addTab("Grupo D", null, panel_3, null);

    this.panel_4 =
        new PanelResultados(
            ListaTimes.getListaTimes()[listaDoGrupoE.get(0)],
            ListaTimes.getListaTimes()[listaDoGrupoE.get(1)],
            ListaTimes.getListaTimes()[listaDoGrupoE.get(2)],
            ListaTimes.getListaTimes()[listaDoGrupoE.get(3)],
            apostador,
            24);
    tabbedPane.addTab("Grupo E", null, panel_4, null);

    this.panel_5 =
        new PanelResultados(
            ListaTimes.getListaTimes()[listaDoGrupoF.get(0)],
            ListaTimes.getListaTimes()[listaDoGrupoF.get(1)],
            ListaTimes.getListaTimes()[listaDoGrupoF.get(2)],
            ListaTimes.getListaTimes()[listaDoGrupoF.get(3)],
            apostador,
            30);
    tabbedPane.addTab("Grupo F", null, panel_5, null);

    this.panel_6 =
        new PanelResultados(
            ListaTimes.getListaTimes()[listaDoGrupoG.get(0)],
            ListaTimes.getListaTimes()[listaDoGrupoG.get(1)],
            ListaTimes.getListaTimes()[listaDoGrupoG.get(2)],
            ListaTimes.getListaTimes()[listaDoGrupoG.get(3)],
            apostador,
            36);
    tabbedPane.addTab("Grupo G", null, panel_6, null);

    this.panel_7 =
        new PanelResultados(
            ListaTimes.getListaTimes()[listaDoGrupoH.get(0)],
            ListaTimes.getListaTimes()[listaDoGrupoH.get(1)],
            ListaTimes.getListaTimes()[listaDoGrupoH.get(2)],
            ListaTimes.getListaTimes()[listaDoGrupoH.get(3)],
            apostador,
            42);
    tabbedPane.addTab("Grupo H", null, panel_7, null);

    // título do JFrame
    JLabel lblNewLabel = new JLabel("Agora é hora de pôr os resultados.");
    lblNewLabel.setBounds(10, 21, 373, 21);
    contentPane.add(lblNewLabel);
    /** Button que gera a pontuação dos apostadores */
    JButton btnNewButton = new JButton("Gerar Pontuação");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // clicando no botão, chamamos o método gereResultado() da classe PanelResultados
            panel.gereResultado();
            panel_1.gereResultado();
            panel_2.gereResultado();
            panel_3.gereResultado();
            panel_4.gereResultado();
            panel_5.gereResultado();
            panel_6.gereResultado();
            panel_7.gereResultado();
            // e no final, chamamos o método que gera a pontuação
            gerarPontuacaoApostadores();
            // mostramos a tela de classificação dos apostadores
            TelaClassApostadores telaClassApostadores = new TelaClassApostadores();
            telaClassApostadores.setVisible(true);
            TelaResultados.this.dispose();
          }
        });
    btnNewButton.setBounds(20, 385, 134, 23);
    contentPane.add(btnNewButton);

    btnVoltar = new JButton("Voltar");
    btnVoltar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new TelaInicial().setVisible(true);
            TelaResultados.this.dispose();
          }
        });
    btnVoltar.setBounds(177, 385, 89, 23);
    contentPane.add(btnVoltar);

    // botoes dos relatórios
    JButton btnNewButton_1 = new JButton("Apostas");
    btnNewButton_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Apostas");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_1.setBounds(595, 76, 129, 23);
    contentPane.add(btnNewButton_1);

    JButton btnNewButton_2 = new JButton("Times");
    btnNewButton_2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Times");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_2.setBounds(595, 142, 129, 23);
    contentPane.add(btnNewButton_2);

    JButton btnNewButton_3 = new JButton("Apostadores");
    btnNewButton_3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Apostadores");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_3.setBounds(595, 176, 129, 23);
    contentPane.add(btnNewButton_3);

    JButton btnNewButton_4 = new JButton("Pontuação de Times");
    btnNewButton_4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Times_Pontuacao");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_4.setBounds(595, 108, 129, 23);
    contentPane.add(btnNewButton_4);

    JLabel lblNewLabel_1 = new JLabel("Opções de Relatórios");
    lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewLabel_1.setBounds(590, 55, 146, 14);
    contentPane.add(lblNewLabel_1);

    JButton btNovaCopa = new JButton("Começar nova copa");
    if (ListaJogos.conteJogos() < 64) {
      btNovaCopa.setVisible(true);
    }
    btNovaCopa.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {

            a_dao.comecarNovaCopa();
            GrupoApostadores.getListaApostadores().clear();
            for (int i = 0; i < 64; i++) {
              ListaJogos.getListaDeJogos()[i] = null;
            }
            // adiciona os apostadores na lista de apostadores a paritr do nome
            if (GrupoApostadores.getListaApostadores().size() == 0) {
              // adiciona todos os apostadores na lista de apostadores
              a_dao.addApostadorGrupo();
              for (int i = 0; i < GrupoApostadores.getListaApostadores().size(); i++) {
                // adiciona as apostas de cada apostador na lista de Apostas do mesmo
                a_dao.addInListaApostas(GrupoApostadores.getListaApostadores().get(i).getNome());
              }
              GrupoApostadores.setNumApostadores(GrupoApostadores.getListaApostadores().size());
            }

            // CARREGA OS PONTOS DO APOSTADOR A PARTIR DO SEU NOME
            for (int i = 0; i < GrupoApostadores.getListaApostadores().size(); i++) {
              a_dao.carreguePontos(GrupoApostadores.getListaApostadores().get(i).getNome());
            }
            new TelaInicial().setVisible(true);
            TelaResultados.this.dispose();
          }
        });

    btNovaCopa.setBounds(300, 385, 200, 23);
    contentPane.add(btNovaCopa);

    /** COnstrutor para as quartas de Final */
  }
コード例 #10
0
  private void initialize() {
    frame = new JFrame();
    frame.setSize(828, 520);
    frame.setLocationRelativeTo(null);
    frame.getContentPane().setLayout(null);
    textPane.setBounds(10, 5, 772, 125);
    textPane.setEditorKit(new HTMLEditorKit());

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 11, 792, 301);
    frame.getContentPane().add(tabbedPane);

    JPanel panelCase = new JPanel();
    tabbedPane.addTab("Case Tab", null, panelCase, null);
    panelCase.setLayout(null);

    tableCase = new JTable();
    tableCase.setBounds(10, 11, 634, 219);
    caseRows = new ArrayList<CaseRow>();
    panelCase.add(tableCase);
    tableCaseModel = new CaseTableModel(caseRows);
    tableCase.setModel(tableCaseModel);

    JPanel panel_Query = new JPanel();
    panel_Query.setBounds(10, 323, 792, 141);
    frame.getContentPane().add(panel_Query);
    panel_Query.setLayout(null);
    panel_Query.add(textPane);

    JScrollPane scrollPaneCase = new JScrollPane(tableCase);
    scrollPaneCase.setBounds(10, 11, 754, 164);
    panelCase.add(scrollPaneCase);

    JPanel panelCoalesce = new JPanel();
    tabbedPane.addTab("Coalesce Tab", null, panelCoalesce, null);

    tableCoalesce = new JTable();
    tableCoalesce.setBounds(1, 36, 765, 0);
    panelCoalesce.add(tableCoalesce);
    panelCase.setLayout(null);
    coalesceRows = new ArrayList<CoalesceRow>();
    tableCoalesceModel = new CoalesceTableModel(coalesceRows);
    panelCoalesce.setLayout(null);
    tableCoalesce.setModel(tableCoalesceModel);

    JScrollPane scrollPaneCoalesce = new JScrollPane(tableCoalesce);
    scrollPaneCoalesce.setBounds(10, 11, 767, 131);
    panelCoalesce.add(scrollPaneCoalesce);

    JPanel coalesceButtonPanel = new JPanel();
    coalesceButtonPanel.setBounds(10, 201, 757, 50);
    panelCoalesce.add(coalesceButtonPanel);
    coalesceButtonPanel.setLayout(null);

    JButton coalesceAddBtn = new JButton("ADD");
    coalesceAddBtn.setIcon(new ImageIcon(TeslaCase.class.getResource("/png/addd.png")));
    coalesceAddBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (pojoRow.getRowType() == null) {
              pojoRow.setRowType("Coalesce");
              TeslaTransFunctions.initializeCoalesceTables();
            }
            tableCoalesce.editCellAt(-1, -1);
            if (txtEnterStringField.getText().equals("")) {
              query = TeslaTransFunctions.displayCoalesceQuery(coalesceRows);
              textPane.setText(QueryColorUtil.queryColorChange(query));
              tableCoalesceModel.updateUI(pojoRow);
              tableCoalesce.scrollRectToVisible(
                  tableCoalesce.getCellRect(tableCoalesce.getRowCount() - 1, 0, true));
            } else {
              pojoRow.setCoalesceString(txtEnterStringField.getText());
              query =
                  TeslaTransFunctions.displayCoalesceQuery_1(txtEnterStringField.getText(), query);
              tableCoalesce.editCellAt(-1, -1);
              frame.setVisible(false);
            }
          }
        });
    coalesceAddBtn.setBounds(286, 16, 115, 29);
    coalesceButtonPanel.add(coalesceAddBtn);

    JButton coalescebtnDone = new JButton("DONE");
    coalescebtnDone.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            tableCoalesce.editCellAt(-1, -1);
            if (txtEnterStringField.getText().equals("")) {
              query = TeslaTransFunctions.displayCoalesceQuery(coalesceRows);
              textPane.setText(QueryColorUtil.queryColorChange(query));
              tableCoalesceModel.updateUI(pojoRow);
              tableCoalesce.scrollRectToVisible(
                  tableCoalesce.getCellRect(tableCoalesce.getRowCount() - 1, 0, true));
            } else {
              pojoRow.setCoalesceString(txtEnterStringField.getText());
              query =
                  TeslaTransFunctions.displayCoalesceQuery_1(txtEnterStringField.getText(), query);
              tableCoalesce.editCellAt(-1, -1);
              frame.setVisible(false);
            }
            frame.setVisible(false);
          }
        });
    coalescebtnDone.setBounds(499, 19, 89, 23);
    coalesceButtonPanel.add(coalescebtnDone);

    txtEnterStringField = new JTextField();
    txtEnterStringField.setBounds(287, 158, 146, 26);
    panelCoalesce.add(txtEnterStringField);
    txtEnterStringField.setColumns(10);

    JLabel lblEnterText = new JLabel("Enter Text");
    lblEnterText.setBounds(125, 161, 119, 20);
    panelCoalesce.add(lblEnterText);

    JPanel panelCaseButton = new JPanel();
    panelCaseButton.setBounds(26, 202, 726, 44);
    panelCase.add(panelCaseButton);

    JButton btnAddCase = new JButton("ADD");
    btnAddCase.setBounds(288, 11, 89, 23);
    btnAddCase.setIcon(new ImageIcon(TeslaCase.class.getResource("/png/addd.png")));
    btnAddCase.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (pojoRow.getRowType() == null) {
              pojoRow.setRowType("Case");
              TeslaTransFunctions.initializeCaseTables();
            }
            tableCase.editCellAt(-1, -1);
            query = TeslaTransFunctions.displayCaseQuery(caseRows);
            textPane.setText(QueryColorUtil.queryColorChange(query));
            tableCaseModel.updateUI(pojoRow);
            tableCase.scrollRectToVisible(
                tableCase.getCellRect(tableCase.getRowCount() - 1, 0, true));
          }
        });
    panelCaseButton.setLayout(null);
    panelCaseButton.add(btnAddCase);

    JButton btnNewButton = new JButton("ELSE");
    btnNewButton.setIcon(new ImageIcon(TeslaCase.class.getResource("/png/Locking.png")));
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            tableCase.editCellAt(-1, -1);
            query = TeslaTransFunctions.displayCaseQuery(caseRows);
            textPane.setText(QueryColorUtil.queryColorChange(query));
            tableCaseModel.updateUI1(pojoRow);
            tableCase.scrollRectToVisible(
                tableCase.getCellRect(tableCase.getRowCount() - 1, 0, true));
          }
        });
    btnNewButton.setBounds(496, 11, 89, 23);
    panelCaseButton.add(btnNewButton);

    JButton btnElse = new JButton("DONE");
    btnElse.setIcon(new ImageIcon(TeslaCase.class.getResource("/png/Exit.png")));
    btnElse.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            tableCase.editCellAt(-1, -1);
            frame.setVisible(false);
          }
        });
    btnElse.setBounds(72, 11, 89, 23);
    panelCaseButton.add(btnElse);

    frame.setVisible(true);
  }
コード例 #11
0
  /**
   * Construtor para as oitavas de final
   *
   * @param apostador1
   * @param nome
   * @wbp.parser.constructor
   */
  public TelaResultados(Apostador apostador1, String nome) {
    this.apostador = apostador1;
    // Apostador recebe o parâmetro apostador1
    // timesCopa recebe uma instância de TimesParticipantes, uma classe que possui os times que
    // participam do mundial, e que são acessados publicamente.
    setTitle("Resultados");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 796, 476);

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    // Cria o TabbedPane. São as abas que vimos na tela.
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 53, 575, 324);
    contentPane.add(tabbedPane);
    // chama o construtor das oitavas de final
    this.panel = new PanelResultados(apostador, "oitavas");
    tabbedPane.addTab("Oitavas de Final", null, panel, null);
    panel.setLayout(null);

    // Cada panel criado será adicionado ao Tabbed Pane.

    /** Estes arrayLists servem para pegarmos quais são os tiems de cada grupo */

    // JLabel que diz o nome do apostador e quantos pontos ele possui no momento
    JLabel lblNewLabel = new JLabel("Agora é hora de você pôr os resultados");

    lblNewLabel.setBounds(10, 21, 373, 21);
    contentPane.add(lblNewLabel);

    JButton btnNewButton = new JButton("Gerar Pontuação");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            panel.gereResultadoNasOitavas();
            gerarPontuacaoApostadores();
            TelaClassApostadores tela = new TelaClassApostadores();
            tela.setVisible(true);
            TelaResultados.this.dispose();
            // deixa a tela inicial visível
          }
        });
    btnNewButton.setBounds(20, 385, 124, 23);
    contentPane.add(btnNewButton);

    JButton btnVoltar = new JButton("Voltar");
    btnVoltar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            new TelaInicial().setVisible(true);
            TelaResultados.this.dispose();
          }
        });
    btnVoltar.setBounds(154, 385, 89, 23);
    contentPane.add(btnVoltar);

    JButton btnNewButton_1 = new JButton("Apostas");
    btnNewButton_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Apostas");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_1.setBounds(595, 76, 129, 23);
    contentPane.add(btnNewButton_1);

    JButton btnNewButton_2 = new JButton("Times");
    btnNewButton_2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Times");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_2.setBounds(595, 142, 129, 23);
    contentPane.add(btnNewButton_2);

    JButton btnNewButton_3 = new JButton("Apostadores");
    btnNewButton_3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Apostadores");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_3.setBounds(595, 176, 129, 23);
    contentPane.add(btnNewButton_3);

    JButton btnNewButton_4 = new JButton("Pontuação de Times");
    btnNewButton_4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Times_Pontuacao");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_4.setBounds(595, 108, 129, 23);
    contentPane.add(btnNewButton_4);

    JLabel lblNewLabel_1 = new JLabel("Opções de Relatórios");
    lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewLabel_1.setBounds(590, 55, 146, 14);
    contentPane.add(lblNewLabel_1);
  }
コード例 #12
0
  /**
   * Construtor para as finais
   *
   * @param apostador1
   * @param nome
   * @param nome2
   */
  public TelaResultados(
      Apostador apostador1, String nome, String nome2, String semi, String finais) {
    this.apostador = apostador1;
    setTitle("Resultados");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 796, 476);

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    // Cria o TabbedPane. São as abas que vimos na tela.
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 53, 575, 324);
    contentPane.add(tabbedPane);
    // chama o construtor das oitavas de final
    this.panel = new PanelResultados(apostador, "oitavas", "quartas", "semi", "final");
    tabbedPane.addTab("Final", null, panel, null);
    panel.setLayout(null);

    JLabel lblNewLabel = new JLabel("Agora é hora de você pôr os resultados");
    lblNewLabel.setBounds(10, 21, 373, 21);
    contentPane.add(lblNewLabel);

    JButton btnNewButton = new JButton("Gerar pontuação");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            panel.gereResultadoNasFinais();
            gerarPontuacaoApostadores();
            TelaClassApostadores tela = new TelaClassApostadores();
            tela.setVisible(true);
            TelaResultados.this.dispose();
            // deixa a tela inicial visível
          }
        });
    btnNewButton.setBounds(20, 385, 134, 23);
    contentPane.add(btnNewButton);

    JButton btnVoltar = new JButton("Voltar");
    btnVoltar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            new TelaInicial().setVisible(true);
            TelaResultados.this.dispose();
          }
        });
    btnVoltar.setBounds(177, 385, 89, 23);
    contentPane.add(btnVoltar);
    // botoes dos relatórios
    JButton btnNewButton_1 = new JButton("Apostas");
    btnNewButton_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Apostas");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_1.setBounds(595, 76, 129, 23);
    contentPane.add(btnNewButton_1);

    JButton btnNewButton_2 = new JButton("Times");
    btnNewButton_2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Times");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_2.setBounds(595, 142, 129, 23);
    contentPane.add(btnNewButton_2);

    JButton btnNewButton_3 = new JButton("Apostadores");
    btnNewButton_3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Apostadores");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_3.setBounds(595, 176, 129, 23);
    contentPane.add(btnNewButton_3);

    JButton btnNewButton_4 = new JButton("Pontuação de Times");
    btnNewButton_4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            GeradorRelatorio g = new GeradorRelatorio();
            try {
              g.gerarRelatorio("Relatorio_Times_Pontuacao");
            } catch (EngineException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_4.setBounds(595, 108, 129, 23);
    contentPane.add(btnNewButton_4);

    JLabel lblNewLabel_1 = new JLabel("Opções de Relatórios");
    lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewLabel_1.setBounds(590, 55, 146, 14);
    contentPane.add(lblNewLabel_1);
  }
コード例 #13
0
ファイル: Hauptseite.java プロジェクト: Balroq/GUI
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmElasticoElektronische = new JFrame();
    frmElasticoElektronische.setLocation(new Point(200, 100));
    frmElasticoElektronische.setResizable(false);
    frmElasticoElektronische.setTitle(
        "Elastico - Elektronische Arbeitsschritt / Information / Control / Observation");
    frmElasticoElektronische.setBackground(Color.WHITE);
    frmElasticoElektronische.getContentPane().setBackground(Color.WHITE);
    frmElasticoElektronische.setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage(Hauptseite.class.getResource("/gui/images/LogoFinal.png")));
    frmElasticoElektronische.setBounds(100, 100, 801, 400);
    frmElasticoElektronische.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmElasticoElektronische.getContentPane().setLayout(null);

    // Hier erzeugen wir unsere JPanels
    JPanel panelMenu = new JPanel();
    JPanel panelStricheln = new JPanel();
    JPanel panelStatistik = new JPanel();
    JPanel panelAdministration = new JPanel();

    // Hier setzen wir die Hintergrundfarben fŸr die JPanels
    panelMenu.setBackground(Color.WHITE);
    panelStricheln.setBackground(Color.WHITE);
    panelStatistik.setBackground(Color.WHITE);
    panelAdministration.setBackground(Color.WHITE);

    // Erzeugung eines JTabbedPane-Objektes
    JTabbedPane tabpane = new JTabbedPane(JTabbedPane.TOP);
    tabpane.setForeground(Color.BLACK);
    tabpane.setBackground(Color.WHITE);
    tabpane.setBounds(23, 6, 754, 325);

    // Hier werden die JPanels als Registerkarten hinzugefŸgt
    tabpane.addTab("MenŸ", panelMenu);
    panelMenu.setLayout(null);

    tabpane.addTab("Startseite", panelMenu);
    tabpane.addTab("Stricheln", panelMenu);

    // TODO Stricheln Oberflaeche einbinden
    JLabel lblTodo = new JLabel("TODO");
    lblTodo.setBounds(71, 26, 61, 16);
    panelMenu.add(lblTodo);
    tabpane.addTab("Statistik", panelStatistik);
    panelStatistik.setLayout(null);

    // TODO Statistik Oberflaeche einbinden
    JLabel lblTodo_1 = new JLabel("TODO");
    lblTodo_1.setBounds(64, 70, 61, 16);
    panelStatistik.add(lblTodo_1);
    tabpane.addTab("Administration", panelAdministration);
    panelAdministration.setLayout(null);

    JLabel lblBenutzerverwaltung = new JLabel("Benutzerverwaltung:");
    lblBenutzerverwaltung.setBounds(6, 6, 127, 16);
    panelAdministration.add(lblBenutzerverwaltung);

    JLabel lblOrganisationseinheitenverwaltung = new JLabel("Organisationseinheitenverwaltung:");
    lblOrganisationseinheitenverwaltung.setBounds(6, 97, 252, 16);
    panelAdministration.add(lblOrganisationseinheitenverwaltung);

    JLabel lblSystemverwaltung = new JLabel("Systemverwaltung:");
    lblSystemverwaltung.setBounds(6, 183, 175, 16);
    panelAdministration.add(lblSystemverwaltung);

    JButton btnNeuerBenutzer = new JButton("Benutzer anlegen");
    btnNeuerBenutzer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            NeuerBenutzer NeuerBenutzer = new NeuerBenutzer();
            NeuerBenutzer.setVisible(true);
          }
        });
    btnNeuerBenutzer.setBounds(6, 34, 137, 40);
    panelAdministration.add(btnNeuerBenutzer);

    JButton btnBenutzerBearbeiten = new JButton("Benutzer bearbeiten");
    btnBenutzerBearbeiten.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            BearbeitungBenutzer BearbeitungBenutzer = new BearbeitungBenutzer();
            BearbeitungBenutzer.setVisible(true);
          }
        });
    btnBenutzerBearbeiten.setBounds(155, 34, 144, 40);
    panelAdministration.add(btnBenutzerBearbeiten);

    JButton btnBenutzerLschen = new JButton("Benutzer l\u00F6schen");
    btnBenutzerLschen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            LoescheBenutzer LoescheBenutzer = new LoescheBenutzer();
            LoescheBenutzer.setVisible(true);
          }
        });
    btnBenutzerLschen.setBounds(311, 34, 127, 40);
    panelAdministration.add(btnBenutzerLschen);

    JButton btnNeueOrganisationseinheit = new JButton("Organisationseinheit anlegen");
    btnNeueOrganisationseinheit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            NeueOrgaEinheit NeueOrgaEinheit = new NeueOrgaEinheit();
            NeueOrgaEinheit.setVisible(true);
          }
        });
    btnNeueOrganisationseinheit.setBounds(6, 125, 208, 40);
    panelAdministration.add(btnNeueOrganisationseinheit);

    JButton btnOrgaeinheitInaktivSetzen = new JButton("Organisationseinheit Inaktiv setzen");
    btnOrgaeinheitInaktivSetzen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            OrgaEinheitInaktiv OrgaEinheitInaktiv = new OrgaEinheitInaktiv();
            OrgaEinheitInaktiv.setVisible(true);
          }
        });
    btnOrgaeinheitInaktivSetzen.setBounds(226, 125, 236, 40);
    panelAdministration.add(btnOrgaeinheitInaktivSetzen);

    JButton button = new JButton("?");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Administrationshilfe Administrationshilfe = new Administrationshilfe();
            Administrationshilfe.setVisible(true);
          }
        });
    button.setBounds(698, 244, 29, 29);
    panelAdministration.add(button);

    JButton btnStrichkategorienHinzufgen = new JButton("Strichkategorien anlegen");
    btnStrichkategorienHinzufgen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            NeueStrichkategorie StrichkategorieHinzu = new NeueStrichkategorie();
            StrichkategorieHinzu.setVisible(true);
          }
        });
    btnStrichkategorienHinzufgen.setBounds(6, 211, 180, 40);
    panelAdministration.add(btnStrichkategorienHinzufgen);

    JButton btnOrganisationseinheitWechseln = new JButton("Organisationseinheit wechseln");
    btnOrganisationseinheitWechseln.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            BearbeitungBenutzerOrgaEinheit BearbeitungBenutzerOrgaEinheit =
                new BearbeitungBenutzerOrgaEinheit();
            BearbeitungBenutzerOrgaEinheit.setVisible(true);
          }
        });
    btnOrganisationseinheitWechseln.setBounds(448, 34, 216, 40);
    panelAdministration.add(btnOrganisationseinheitWechseln);

    // JTabbedPane wird unserem Dialog hinzugefŸgt
    frmElasticoElektronische.getContentPane().add(tabpane);

    JButton btnNewButton_2 = new JButton("Beenden");
    btnNewButton_2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            AnwendungAbbruch frmAnwendungAbbruch = new AnwendungAbbruch();
            frmAnwendungAbbruch.setVisible(true);
          }
        });
    btnNewButton_2.setBounds(660, 332, 117, 29);
    frmElasticoElektronische.getContentPane().add(btnNewButton_2);

    JButton btnNewButton_1 = new JButton("?");
    btnNewButton_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            HauptseiteHilfe frmHauptmenueHilfe = new HauptseiteHilfe();
            frmHauptmenueHilfe.setVisible(true);
          }
        });
    btnNewButton_1.setBounds(33, 332, 29, 29);
    frmElasticoElektronische.getContentPane().add(btnNewButton_1);

    // TODO Aktion einbinden, sodass der hinter dem benutzernamen stehende Name mit Vor- und
    // Nachname angezeigt wird.
    JLabel lblEingeloggtAlsJanis = new JLabel("Eingeloggt als: Janis H\u00F6pken");
    lblEingeloggtAlsJanis.setBounds(74, 337, 180, 16);
    frmElasticoElektronische.getContentPane().add(lblEingeloggtAlsJanis);
  }
コード例 #14
0
ファイル: LaunchFrame.java プロジェクト: eightbitme/FTBLaunch
  /** Create the frame. */
  public LaunchFrame(final int tab) {
    setFont(new Font("a_FuturaOrto", Font.PLAIN, 12));
    setResizable(false);
    setTitle("Feed the Beast Launcher v" + version);
    setIconImage(
        Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/image/logo_ftb.png")));

    panel = new JPanel();

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    if (OSUtils.getCurrentOS() == OS.WINDOWS) {
      setBounds(100, 100, 842, 480);
    } else {
      setBounds(100, 100, 850, 480);
    }
    panel.setBounds(0, 0, 850, 480);
    panel.setLayout(null);
    footer.setBounds(0, 380, 850, 100);
    footer.setLayout(null);
    footer.setBackground(LauncherStyle.getCurrentStyle().footerColor);
    tabbedPane.setBounds(0, 0, 850, 380);
    panel.add(tabbedPane);
    panel.add(footer);
    setContentPane(panel);

    // Footer
    // footerLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    // footerLogo.setBounds(20, 20, 42, 42);
    // footerLogo.addMouseListener(new MouseAdapter() {
    // @Override
    // public void mouseClicked(MouseEvent event) {
    // OSUtils.browse("http://www.feed-the-beast.com");
    // }
    // });

    footerCreeper.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    footerCreeper.setBounds(25, 20, 150, 42);
    footerCreeper.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent event) {
            OSUtils.browse("http://www.mckhaos.net");
          }
        });

    dropdown_[0] = I18N.getLocaleString("PROFILE_SELECT");
    dropdown_[1] = I18N.getLocaleString("PROFILE_CREATE");

    String[] dropdown =
        concatenateArrays(dropdown_, UserManager.getNames().toArray(new String[] {}));
    users = new JComboBox(dropdown);
    if (Settings.getSettings().getLastUser() != null) {
      for (int i = 0; i < dropdown.length; i++) {
        if (dropdown[i].equalsIgnoreCase(Settings.getSettings().getLastUser())) {
          users.setSelectedIndex(i);
        }
      }
    }

    donate = new JButton(I18N.getLocaleString("DONATE_BUTTON"));
    donate.setBounds(390, 20, 80, 30);
    donate.setEnabled(false);
    donate.setToolTipText("Coming Soon...");
    donate.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {}
        });

    users.setBounds(550, 20, 150, 30);
    users.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (users.getSelectedIndex() == 1) {
              ProfileAdderDialog p = new ProfileAdderDialog(getInstance(), true);
              users.setSelectedIndex(0);
              p.setVisible(true);
            }
            edit.setEnabled(users.getSelectedIndex() > 1);
          }
        });

    edit = new JButton(I18N.getLocaleString("EDIT_BUTTON"));
    edit.setBounds(480, 20, 60, 30);
    edit.setVisible(true);
    edit.setEnabled(users.getSelectedIndex() > 1);
    edit.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            if (users.getSelectedIndex() > 1) {
              ProfileEditorDialog p =
                  new ProfileEditorDialog(getInstance(), (String) users.getSelectedItem(), true);
              users.setSelectedIndex(0);
              p.setVisible(true);
            }
            edit.setEnabled(users.getSelectedIndex() > 1);
          }
        });

    launch.setText(I18N.getLocaleString("LAUNCH_BUTTON"));
    launch.setBounds(711, 20, 100, 30);
    launch.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            doLaunch();
          }
        });

    serverbutton.setBounds(480, 20, 330, 30);
    serverbutton.setText(I18N.getLocaleString("DOWNLOAD_SERVER_PACK"));
    serverbutton.setVisible(false);
    serverbutton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            if (!ModPack.getSelectedPack().getServerUrl().isEmpty()) {
              if (getSelectedModIndex() >= 0) {
                try {
                  String version =
                      (Settings.getSettings().getPackVer().equalsIgnoreCase("recommended version")
                              || Settings.getSettings()
                                  .getPackVer()
                                  .equalsIgnoreCase("newest version"))
                          ? ModPack.getSelectedPack().getVersion().replace(".", "_")
                          : Settings.getSettings().getPackVer().replace(".", "_");
                  if (ModPack.getSelectedPack().isPrivatePack()) {
                    OSUtils.browse(
                        DownloadUtils.getCreeperhostLink(
                            "privatepacks%5E"
                                + ModPack.getSelectedPack().getDir()
                                + "%5E"
                                + version
                                + "%5E"
                                + ModPack.getSelectedPack().getServerUrl()));
                  } else {
                    OSUtils.browse(
                        DownloadUtils.getCreeperhostLink(
                            "modpacks%5E"
                                + ModPack.getSelectedPack().getDir()
                                + "%5E"
                                + version
                                + "%5E"
                                + ModPack.getSelectedPack().getServerUrl()));
                  }
                  TrackerUtils.sendPageView(
                      ModPack.getSelectedPack().getName() + " Server Download",
                      ModPack.getSelectedPack().getName());
                } catch (NoSuchAlgorithmException e) {
                }
              }
            }
          }
        });

    mapInstall.setBounds(650, 20, 160, 30);
    mapInstall.setText(I18N.getLocaleString("INSTALL_MAP"));
    mapInstall.setVisible(false);
    mapInstall.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            if (getSelectedMapIndex() >= 0) {
              MapManager man = new MapManager(new JFrame(), true);
              man.setVisible(true);
              MapManager.cleanUp();
            }
          }
        });

    mapInstallLocation = new JComboBox();
    mapInstallLocation.setBounds(480, 20, 160, 30);
    mapInstallLocation.setToolTipText("Install to...");
    mapInstallLocation.setVisible(false);

    serverMap.setBounds(480, 20, 330, 30);
    serverMap.setText(I18N.getLocaleString("DOWNLOAD_MAP_SERVER"));
    serverMap.setVisible(false);
    serverMap.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            if (getSelectedMapIndex() >= 0) {
              try {
                OSUtils.browse(
                    DownloadUtils.getCreeperhostLink(
                        "maps%5E"
                            + Map.getMap(LaunchFrame.getSelectedMapIndex()).getMapName()
                            + "%5E"
                            + Map.getMap(LaunchFrame.getSelectedMapIndex()).getVersion()
                            + "%5E"
                            + Map.getMap(LaunchFrame.getSelectedMapIndex()).getUrl()));
              } catch (NoSuchAlgorithmException e) {
              }
            }
          }
        });

    tpInstall.setBounds(650, 20, 160, 30);
    tpInstall.setText(I18N.getLocaleString("INSTALL_TEXTUREPACK"));
    tpInstall.setVisible(false);
    tpInstall.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            if (getSelectedTexturePackIndex() >= 0) {
              TextureManager man = new TextureManager(new JFrame(), true);
              man.setVisible(true);
            }
          }
        });

    tpInstallLocation = new JComboBox();
    tpInstallLocation.setBounds(480, 20, 160, 30);
    tpInstallLocation.setToolTipText("Install to...");
    tpInstallLocation.setVisible(false);

    tpInstallLocLbl.setText("Install to...");
    tpInstallLocLbl.setBounds(480, 20, 80, 30);
    tpInstallLocLbl.setVisible(false);

    footer.add(edit);
    footer.add(users);
    footer.add(footerLogo);
    footer.add(footerCreeper);
    footer.add(launch);
    footer.add(donate);
    footer.add(serverbutton);
    footer.add(mapInstall);
    footer.add(mapInstallLocation);
    footer.add(serverMap);
    footer.add(tpInstall);
    footer.add(tpInstallLocation);

    newsPane = new NewsPane();
    modPacksPane = new ModpacksPane();
    mapsPane = new MapsPane();
    tpPane = new TexturepackPane();
    optionsPane = new OptionsPane(Settings.getSettings());

    getRootPane().setDefaultButton(launch);
    updateLocale();

    tabbedPane.add(newsPane, 0);
    tabbedPane.add(optionsPane, 1);
    tabbedPane.add(modPacksPane, 2);
    tabbedPane.add(mapsPane, 3);
    tabbedPane.add(tpPane, 4);
    setNewsIcon();
    tabbedPane.setIconAt(1, new ImageIcon(this.getClass().getResource("/image/tabs/options.png")));
    tabbedPane.setIconAt(2, new ImageIcon(this.getClass().getResource("/image/tabs/modpacks.png")));
    tabbedPane.setIconAt(3, new ImageIcon(this.getClass().getResource("/image/tabs/maps.png")));
    tabbedPane.setIconAt(
        4, new ImageIcon(this.getClass().getResource("/image/tabs/texturepacks.png")));
    tabbedPane.setSelectedIndex(tab);

    tabbedPane.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent event) {
            if (tabbedPane.getSelectedComponent() instanceof ILauncherPane) {
              ((ILauncherPane) tabbedPane.getSelectedComponent()).onVisible();
              currentPane = Panes.values()[tabbedPane.getSelectedIndex()];
              updateFooter();
            }
          }
        });
  }
コード例 #15
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.getContentPane().setBackground(Color.WHITE);
    frame.getContentPane().setForeground(Color.RED);
    frame.setBackground(Color.WHITE);
    frame.setBounds(100, 100, 613, 459);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setForeground(Color.BLACK);
    tabbedPane.setBackground(Color.WHITE);
    tabbedPane.setBounds(1, 2, 596, 408);
    frame.getContentPane().add(tabbedPane);

    JPanel panel_1 = new JPanel();
    panel_1.setBackground(Color.WHITE);
    panel_1.setForeground(Color.GREEN);
    tabbedPane.addTab("Recieved Mail", null, panel_1, null);
    panel_1.setLayout(null);

    JTextPane textPane_1 = new JTextPane();
    textPane_1.setBackground(Color.WHITE);
    textPane_1.setForeground(Color.BLACK);
    textPane_1.setEditable(false);

    JScrollPane scrollPane1 = new JScrollPane(textPane_1);
    scrollPane1.setBounds(150, 100, 420, 250);
    panel_1.add(scrollPane1);

    // panel_1.add(textPane_1);

    DefaultListModel listModel = new DefaultListModel();
    File[] files1 = new File("src/inbox").listFiles();
    for (File file : files1) {
      if (file.isFile())
        listModel.addElement((file.getName()).substring(0, (file.getName()).length() - 4));
    }

    JList list = new JList(listModel);
    list.setForeground(Color.BLACK);
    list.setBackground(Color.WHITE);

    // list.setBounds(10, 11, 112, 280);
    // panel_1.add(list);

    JScrollPane scrollPane = new JScrollPane(list);
    // scrollPane.setViewportView(list);
    scrollPane.setBounds(20, 11, 112, 340);
    panel_1.add(scrollPane);

    JLabel lblMessage = new JLabel("Message");
    lblMessage.setForeground(Color.BLACK);
    lblMessage.setBounds(175, 77, 79, 14);
    panel_1.add(lblMessage);

    JPanel panel = new JPanel();
    panel.setBackground(Color.WHITE);
    tabbedPane.addTab("Send Email", null, panel, null);
    panel.setLayout(null);

    JComboBox contactCombo = new JComboBox();
    contactCombo.setForeground(Color.BLACK);
    contactCombo.setBackground(Color.WHITE);
    contactCombo.setBounds(172, 21, 409, 20);
    panel.add(contactCombo);

    JLabel label = new JLabel("Message:");
    label.setForeground(Color.BLACK);
    label.setBounds(13, 117, 91, 14);
    panel.add(label);

    JTextPane messagePane = new JTextPane();
    messagePane.setBackground(Color.WHITE);
    messagePane.setForeground(Color.BLACK);
    messagePane.setBounds(10, 124, 539, 194);
    // panel.add(messagePane);

    JButton button_1 = new JButton("Send");
    button_1.setForeground(Color.BLACK);
    button_1.setBackground(Color.WHITE);
    button_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            String to = contactCombo.getSelectedItem().toString();
            String subject = txtSubject.getText();
            Random rn = new Random();
            String ShareID = Integer.toString((new Random()).nextInt((999999999 - 100) + 1) + 100);
            System.out.println(ShareID);
            String from = "src/proxies/proxies.txt";
            String message = messagePane.getText();
            try {
              // if(selectedFileIn == true)
              System.out.println("sendmail1");
              SendMail.Distributor(to, ShareID, from, message, "", subject);
              System.out.println("sendmail2");
              // selectedFileIn = false;
            } catch (IOException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
            messagePane.setText("");
            contactCombo.repaint();
            attField.setText("");
            attField.removeAll();
          }
        });

    JScrollPane sP =
        new JScrollPane(
            messagePane,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    sP.setBounds(13, 142, 568, 194);
    panel.add(sP);
    button_1.setBounds(482, 346, 99, 23);
    panel.add(button_1);

    JLabel lblTo = new JLabel("To");
    lblTo.setForeground(Color.BLACK);
    lblTo.setBackground(Color.BLACK);
    lblTo.setBounds(116, 24, 46, 14);
    panel.add(lblTo);

    attField = new JTextField();
    attField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {}
        });
    attField.setBounds(172, 52, 409, 20);
    panel.add(attField);
    attField.setColumns(10);

    JButton btnSearchButton = new JButton("Search");
    btnSearchButton.setBackground(Color.WHITE);
    btnSearchButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.showOpenDialog(frame);
            // fileChooser.setCurrentDirectory(new File(System.getProperty("src/")));
            selectedFile = fileChooser.getSelectedFile();
            attField.setText(selectedFile.getName());
            selectedFileIn = true;
            // selectedFile = fileChooser.getSelectedFile();
          }
        });
    btnSearchButton.setBounds(73, 51, 89, 23);
    panel.add(btnSearchButton);

    txtSubject = new JTextField();
    txtSubject.setBounds(172, 83, 409, 20);
    panel.add(txtSubject);
    txtSubject.setColumns(10);

    JLabel lblSubject = new JLabel("Subject");
    lblSubject.setForeground(Color.BLACK);
    lblSubject.setBackground(Color.BLACK);
    lblSubject.setBounds(116, 85, 46, 14);
    panel.add(lblSubject);

    JPanel panel_2 = new JPanel();
    panel_2.setBackground(Color.WHITE);
    tabbedPane.addTab("Add Contact", null, panel_2, null);
    panel_2.setLayout(null);

    JLabel lblEmailAddress = new JLabel("Email Address");
    lblEmailAddress.setForeground(Color.BLACK);
    lblEmailAddress.setBounds(75, 159, 72, 14);
    panel_2.add(lblEmailAddress);

    JTextPane proxyPane = new JTextPane();
    proxyPane.setForeground(Color.BLACK);
    proxyPane.setBackground(Color.LIGHT_GRAY);
    proxyPane.setBounds(157, 159, 298, 102);
    panel_2.add(proxyPane);

    JLabel lblContactName = new JLabel("Contact Name");
    lblContactName.setForeground(Color.BLACK);
    lblContactName.setBounds(69, 124, 72, 14);
    panel_2.add(lblContactName);

    contactField = new JTextField();
    contactField.setBackground(Color.LIGHT_GRAY);
    contactField.setColumns(10);
    contactField.setBounds(157, 121, 298, 20);
    panel_2.add(contactField);

    JButton btnAddContact = new JButton("Add Contact");
    btnAddContact.setBackground(Color.WHITE);
    btnAddContact.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            BufferedWriter output = null;
            // Add new contact
            String conName = contactField.getText();
            String allprox = proxyPane.getText();
            File conFile = new File("src/contacts/" + conName + ".txt");
            try {
              output = new BufferedWriter(new FileWriter(conFile));
              output.write(allprox);
              output.close();
            } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });
    btnAddContact.setBounds(157, 301, 118, 23);
    panel_2.add(btnAddContact);

    // List<String> contacts = new ArrayList<String>();
    // comboBox.addItem("hg");
    File[] files = new File("src/contacts").listFiles();
    for (File file : files) {
      if (file.isFile())
        contactCombo.addItem((file.getName()).substring(0, (file.getName()).length() - 4));
    }
    list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            String strbldr = "";
            String loc = "src/inbox/" + list.getSelectedValue().toString() + ".txt";
            try {
              BufferedReader buffread = new BufferedReader(new FileReader(loc));
              String line = buffread.readLine();
              while (line != null) {
                strbldr += line;
                strbldr += "\n";
                line = buffread.readLine();
              }
              buffread.close();
            } catch (Exception e) {
            }
            ;
            textPane_1.setText(strbldr);
            textPane_1.setCaretPosition(0);
          }
        });
    class Inner extends Thread {

      public void run() {

        do {
          System.out.println("Hello from a thread!");
          try {
            ReceiveMail.run();
            scrollPane.repaint();
            this.sleep(10000);
          } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        } while (true);
      }

      public void main(String args[]) {
        (new Inner()).start();
      }
    }
    Inner reloads = new Inner();
    reloads.start();
  }
コード例 #16
0
ファイル: prueba.java プロジェクト: SebasPelaez/ProyectosJava
  public prueba() {
    setTitle("Requerimientos");
    setBounds(100, 100, 898, 622);
    setLocationRelativeTo(null);
    getContentPane().setLayout(null);
    setIconImage(new ImageIcon("Imagenes\\Iconito.png").getImage());
    Val = new principalIController();
    DatosIncidentes = new Object[pc.obtenerFilasIncidentes(0, "")][6];

    fecha = new Date();
    formateador = new SimpleDateFormat("yyyy-MM-dd");
    fechaF = formateador.format(fecha);

    Icon crear = new ImageIcon("Imagenes\\paper.png");
    btnCrear = new JButton("Crear", crear);
    btnCrear.setBounds(20, 29, 120, 40);
    btnCrear.addActionListener(this);
    getContentPane().add(btnCrear);

    Icon find = new ImageIcon("Imagenes\\find.png");
    btnConsultar = new JButton("Consultar", find);
    btnConsultar.setBounds(20, 80, 120, 40);
    btnConsultar.addActionListener(this);
    getContentPane().add(btnConsultar);

    panelSostenedor = new JPanel();
    panelSostenedor.setBounds(163, 29, 689, 544);
    getContentPane().add(panelSostenedor);
    panelSostenedor.setLayout(null);

    JTabbedPane pestañas = new JTabbedPane(JTabbedPane.TOP);
    pestañas.setBounds(10, 11, 648, 526);
    panelSostenedor.add(pestañas);

    JPanel panelInfoBasica = new JPanel();
    panelInfoBasica.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    pestañas.addTab("Información básica", null, panelInfoBasica, null);
    panelInfoBasica.setLayout(null);

    JPanel infRequerimiento = new JPanel();
    infRequerimiento.setBorder(
        new TitledBorder(
            null,
            "INFORMACI\u00D3N REQUERIMIENTO",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    infRequerimiento.setBounds(10, 18, 623, 186);
    panelInfoBasica.add(infRequerimiento);
    infRequerimiento.setLayout(null);

    JLabel lblCodigoRequerimiento = new JLabel("C\u00F3digo requerimiento");
    lblCodigoRequerimiento.setBounds(21, 33, 140, 18);
    infRequerimiento.add(lblCodigoRequerimiento);

    txtCodigoRequerimiento = new JTextField();
    txtCodigoRequerimiento.setBounds(21, 58, 101, 25);
    txtCodigoRequerimiento.setEnabled(false);
    txtCodigoRequerimiento.setText(String.valueOf(Val.codigoConsecutivo()));
    infRequerimiento.add(txtCodigoRequerimiento);
    txtCodigoRequerimiento.setColumns(10);

    JLabel lblFechaRequerimiento = new JLabel("Fecha requerimiento");
    lblFechaRequerimiento.setBounds(192, 33, 142, 18);
    infRequerimiento.add(lblFechaRequerimiento);

    txtFechaRequerimiento = new JTextField();
    txtFechaRequerimiento.setBounds(192, 58, 155, 25);
    txtFechaRequerimiento.setText(fechaF);
    txtFechaRequerimiento.setEnabled(false);
    infRequerimiento.add(txtFechaRequerimiento);
    txtFechaRequerimiento.setColumns(10);

    JLabel lblTipoRequerimiento = new JLabel("Tipo requerimiento");
    lblTipoRequerimiento.setBounds(402, 33, 109, 18);
    infRequerimiento.add(lblTipoRequerimiento);

    jcbTipoRequerimiento = new JComboBox();
    jcbTipoRequerimiento.setBounds(402, 58, 101, 25);
    jcbTipoRequerimiento.addActionListener(this);
    infRequerimiento.add(jcbTipoRequerimiento);

    JLabel lblEstado = new JLabel("Estado");
    lblEstado.setBounds(21, 107, 119, 18);
    infRequerimiento.add(lblEstado);

    jcbEstado = new JComboBox();
    jcbEstado.setBounds(21, 132, 101, 25);
    jcbEstado.setEnabled(false);
    infRequerimiento.add(jcbEstado);

    JLabel lblPrioridad = new JLabel("Prioridad");
    lblPrioridad.setBounds(192, 107, 109, 18);
    infRequerimiento.add(lblPrioridad);

    jcbNivelRequerimiento = new JComboBox();
    jcbNivelRequerimiento.setBounds(192, 132, 101, 25);
    infRequerimiento.add(jcbNivelRequerimiento);

    JPanel infCliente = new JPanel();
    infCliente.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "INFORMACI\u00D3N CLIENTE",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    infCliente.setBounds(10, 225, 623, 256);
    panelInfoBasica.add(infCliente);
    infCliente.setLayout(null);

    JLabel lblIdentificacin = new JLabel("Identificaci\u00F3n");
    lblIdentificacin.setBounds(20, 30, 101, 18);
    infCliente.add(lblIdentificacin);

    JLabel lblNewLabel = new JLabel("Nombre");
    lblNewLabel.setBounds(172, 30, 77, 18);
    infCliente.add(lblNewLabel);

    JLabel lblCorreElectronico = new JLabel("Corre electr\u00F3nico");
    lblCorreElectronico.setBounds(20, 159, 108, 18);
    infCliente.add(lblCorreElectronico);

    txtIdCliente = new JTextField();
    txtIdCliente.setBounds(20, 55, 108, 25);
    txtIdCliente.addFocusListener(this);
    infCliente.add(txtIdCliente);
    txtIdCliente.setColumns(10);

    txtNombreCliente = new JTextField();
    txtNombreCliente.setBounds(172, 55, 164, 25);
    txtNombreCliente.setEnabled(false);
    infCliente.add(txtNombreCliente);
    txtNombreCliente.setColumns(10);

    txtCorreoCliente = new JTextField();
    txtCorreoCliente.setBounds(20, 187, 177, 25);
    txtCorreoCliente.setEnabled(false);
    infCliente.add(txtCorreoCliente);
    txtCorreoCliente.setColumns(10);

    lblEmpresa = new JLabel("Empresa");
    lblEmpresa.setBounds(386, 96, 101, 18);
    infCliente.add(lblEmpresa);

    JLabel lblTelfono = new JLabel("Tel\u00E9fono");
    lblTelfono.setBounds(20, 96, 89, 18);
    infCliente.add(lblTelfono);

    JLabel lblDireccion = new JLabel("Direcci\u00F3n");
    lblDireccion.setBounds(172, 96, 89, 18);
    infCliente.add(lblDireccion);

    txtDireccionCliente = new JTextField();
    txtDireccionCliente.setBounds(172, 121, 164, 25);
    txtDireccionCliente.setEnabled(false);
    infCliente.add(txtDireccionCliente);
    txtDireccionCliente.setColumns(10);

    txtTelefonoCliente = new JTextField();
    txtTelefonoCliente.setBounds(20, 121, 108, 25);
    txtTelefonoCliente.setEnabled(false);
    infCliente.add(txtTelefonoCliente);
    txtTelefonoCliente.setColumns(10);

    txtEmpresaCliente = new JTextField();
    txtEmpresaCliente.setBounds(386, 121, 163, 25);
    txtEmpresaCliente.setEnabled(false);
    infCliente.add(txtEmpresaCliente);
    txtEmpresaCliente.setColumns(10);

    JLabel lblApellido = new JLabel("Apellidos");
    lblApellido.setBounds(386, 32, 101, 14);
    infCliente.add(lblApellido);

    txtApellidosCliente = new JTextField();
    txtApellidosCliente.setBounds(385, 55, 164, 25);
    txtApellidosCliente.setEnabled(false);
    infCliente.add(txtApellidosCliente);
    txtApellidosCliente.setColumns(10);

    JPanel panelProblemas = new JPanel();
    pestañas.addTab("Problemas", null, panelProblemas, null);
    panelProblemas.setLayout(null);

    JPanel tiposProblemas = new JPanel();
    tiposProblemas.setBorder(
        new TitledBorder(
            null, "TIPOS DE PROBLEMAS", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    tiposProblemas.setBounds(10, 11, 585, 433);
    panelProblemas.add(tiposProblemas);
    tiposProblemas.setLayout(null);

    JPanel problemaTecnico = new JPanel();
    problemaTecnico.setBorder(
        new TitledBorder(
            null, "PROBLEMAS T\u00C9CNICOS", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    problemaTecnico.setBounds(10, 29, 283, 146);
    tiposProblemas.add(problemaTecnico);
    problemaTecnico.setLayout(null);

    chbNoprende = new JCheckBox("No prende");
    chbNoprende.setBounds(12, 30, 100, 20);
    chbNoprende.addActionListener(this);
    problemaTecnico.add(chbNoprende);

    chbReinicia = new JCheckBox("Se reinicia");
    chbReinicia.setBounds(12, 50, 100, 20);
    chbReinicia.addActionListener(this);
    problemaTecnico.add(chbReinicia);

    chbArchivosPerdidos = new JCheckBox("Archivos perdidos");
    chbArchivosPerdidos.setBounds(12, 70, 135, 20);
    chbArchivosPerdidos.addActionListener(this);
    problemaTecnico.add(chbArchivosPerdidos);

    chbBloqueo = new JCheckBox("Bloqueo/Lentitud");
    chbBloqueo.setBounds(12, 90, 150, 20);
    chbBloqueo.addActionListener(this);
    problemaTecnico.add(chbBloqueo);

    chbSinAudio = new JCheckBox("No se oye");
    chbSinAudio.setBounds(12, 110, 150, 20);
    chbSinAudio.addActionListener(this);
    problemaTecnico.add(chbSinAudio);

    chbMensaje = new JCheckBox("Mensaje de error");
    chbMensaje.setBounds(145, 30, 120, 20);
    chbMensaje.addActionListener(this);
    problemaTecnico.add(chbMensaje);

    chbSinRed = new JCheckBox("Conexión de red");
    chbSinRed.setBounds(145, 50, 120, 20);
    chbSinRed.addActionListener(this);
    problemaTecnico.add(chbSinRed);

    chbOtrosTec = new JCheckBox("Otros");
    chbOtrosTec.setBounds(145, 70, 100, 20);
    chbOtrosTec.addActionListener(this);
    problemaTecnico.add(chbOtrosTec);

    JPanel problemaHardware = new JPanel();
    problemaHardware.setBorder(
        new TitledBorder(
            null, "PROBLEMAS HARDWARE", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    problemaHardware.setBounds(303, 29, 272, 146);
    tiposProblemas.add(problemaHardware);
    problemaHardware.setLayout(null);

    chbMonitor = new JCheckBox("Monitor");
    chbMonitor.setBounds(12, 30, 100, 20);
    chbMonitor.addActionListener(this);
    problemaHardware.add(chbMonitor);

    chbMouse = new JCheckBox("Mouse");
    chbMouse.setBounds(12, 50, 100, 20);
    chbMouse.addActionListener(this);
    problemaHardware.add(chbMouse);

    chbTeclado = new JCheckBox("Teclado");
    chbTeclado.setBounds(12, 70, 100, 20);
    chbTeclado.addActionListener(this);
    problemaHardware.add(chbTeclado);

    chbRegulador = new JCheckBox("Regulador");
    chbRegulador.setBounds(12, 90, 100, 20);
    chbRegulador.addActionListener(this);
    problemaHardware.add(chbRegulador);

    chbParlantes = new JCheckBox("Parlantes");
    chbParlantes.setBounds(12, 110, 100, 20);
    chbParlantes.addActionListener(this);
    problemaHardware.add(chbParlantes);

    chbUnidadCdDvd = new JCheckBox("Unidad CD/DVD");
    chbUnidadCdDvd.setBounds(145, 30, 120, 20);
    chbUnidadCdDvd.addActionListener(this);
    problemaHardware.add(chbUnidadCdDvd);

    chbPuertoUsb = new JCheckBox("Puerto USB");
    chbPuertoUsb.setBounds(145, 50, 100, 20);
    chbPuertoUsb.addActionListener(this);
    problemaHardware.add(chbPuertoUsb);

    chbOtroHard = new JCheckBox("Otro");
    chbOtroHard.setBounds(145, 70, 100, 20);
    chbOtroHard.addActionListener(this);
    problemaHardware.add(chbOtroHard);

    JPanel instalacion = new JPanel();
    instalacion.setBorder(
        new TitledBorder(
            null, "INSTALACI\u00D3N SOFTWARE", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    instalacion.setBounds(157, 208, 283, 156);
    tiposProblemas.add(instalacion);
    instalacion.setLayout(null);

    chbAntivirus = new JCheckBox("Antivirus");
    chbAntivirus.setBounds(12, 30, 80, 20);
    chbAntivirus.addActionListener(this);
    instalacion.add(chbAntivirus);

    chbDriver = new JCheckBox("Drivers/Controladores");
    chbDriver.setBounds(12, 50, 150, 20);
    chbDriver.addActionListener(this);
    instalacion.add(chbDriver);

    chbOfice = new JCheckBox("Paquete office");
    chbOfice.setBounds(12, 70, 135, 20);
    chbOfice.addActionListener(this);
    instalacion.add(chbOfice);

    chbTodos = new JCheckBox("Todos los programas");
    chbTodos.setBounds(12, 90, 145, 20);
    chbTodos.addActionListener(this);
    instalacion.add(chbTodos);

    chbOtrosInsta = new JCheckBox("Otros");
    chbOtrosInsta.setBounds(12, 110, 135, 20);
    chbOtrosInsta.addActionListener(this);
    instalacion.add(chbOtrosInsta);

    JPanel panelObservacion = new JPanel();
    pestañas.addTab("Observaciones", null, panelObservacion, null);
    panelObservacion.setLayout(null);

    panelDescripcion = new JPanel();
    panelDescripcion.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "DESCRIPCI\u00D3N",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panelDescripcion.setBounds(10, 90, 585, 123);
    panelObservacion.add(panelDescripcion);
    panelDescripcion.setLayout(null);

    txaDescripcion = new JTextArea();
    txaDescripcion.setLineWrap(true);
    txaDescripcion.addFocusListener(this);
    txaDescripcion.setBounds(20, 21, 542, 88);
    panelDescripcion.add(txaDescripcion);

    JPanel panelAsunto = new JPanel();
    panelAsunto.setBorder(
        new TitledBorder(null, "ASUNTO", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelAsunto.setBounds(10, 11, 585, 69);
    panelObservacion.add(panelAsunto);
    panelAsunto.setLayout(null);

    txtAsunto = new JTextField();
    txtAsunto.setBounds(20, 25, 541, 25);
    txtAsunto.addFocusListener(this);
    txtAsunto.setEditable(false);
    panelAsunto.add(txtAsunto);
    txtAsunto.setColumns(10);

    panelObservaciones = new JPanel();
    panelObservaciones.setBorder(
        new TitledBorder(
            null, "OBSERVACIONES", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelObservaciones.setBounds(10, 228, 585, 123);
    panelObservacion.add(panelObservaciones);
    panelObservaciones.setLayout(null);

    txaObservaciones = new JTextArea();
    txaObservaciones.setBounds(20, 21, 542, 88);
    txaObservaciones.addFocusListener(this);
    panelObservaciones.add(txaObservaciones);

    panelSolucion = new JPanel();
    panelSolucion.setBorder(
        new TitledBorder(
            null, "SOLUCI\u00D3N", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelSolucion.setBounds(10, 362, 585, 125);
    panelObservacion.add(panelSolucion);
    panelSolucion.setLayout(null);

    txaSolucion = new JTextArea();
    txaSolucion.setBounds(20, 21, 542, 88);
    txaSolucion.addFocusListener(this);
    panelSolucion.add(txaSolucion);

    panelUsuarios = new JPanel();
    pestañas.addTab("Usuarios", null, panelUsuarios, null);
    panelUsuarios.setLayout(null);

    panelAtendido = new JPanel();
    panelAtendido.setBorder(
        new TitledBorder(null, "ATENDIDO POR", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelAtendido.setBounds(10, 11, 585, 100);
    panelUsuarios.add(panelAtendido);
    panelAtendido.setLayout(null);

    lblIdReceptor = new JLabel("Identificaci\u00F3n");
    lblIdReceptor.setBounds(22, 24, 116, 18);
    panelAtendido.add(lblIdReceptor);

    lblNombreReceptor = new JLabel("Nombre");
    lblNombreReceptor.setBounds(185, 24, 85, 18);
    panelAtendido.add(lblNombreReceptor);

    lblApellidosReceptor = new JLabel("Apellidos");
    lblApellidosReceptor.setBounds(400, 24, 95, 18);
    panelAtendido.add(lblApellidosReceptor);

    txtIdReceptor = new JTextField();
    txtIdReceptor.setBounds(22, 53, 116, 25);
    txtIdReceptor.setText(lSG.getId_Empleado());
    txtIdReceptor.setEnabled(false);
    panelAtendido.add(txtIdReceptor);
    txtIdReceptor.setColumns(10);

    txtNombreReceptor = new JTextField();
    txtNombreReceptor.setBounds(185, 53, 170, 25);
    txtNombreReceptor.setText(lSG.getNombre());
    txtNombreReceptor.setEnabled(false);
    panelAtendido.add(txtNombreReceptor);
    txtNombreReceptor.setColumns(10);

    txtApellidosReceptor = new JTextField();
    txtApellidosReceptor.setBounds(400, 53, 170, 25);
    txtApellidosReceptor.setText(lSG.getApellido());
    txtApellidosReceptor.setEnabled(false);
    panelAtendido.add(txtApellidosReceptor);
    txtApellidosReceptor.setColumns(10);

    panelAsignado = new JPanel();
    panelAsignado.setBorder(
        new TitledBorder(null, "ASIGNADO A", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelAsignado.setBounds(10, 134, 585, 100);
    panelUsuarios.add(panelAsignado);
    panelAsignado.setLayout(null);

    txtIdAsignado = new JTextField();
    txtIdAsignado.setColumns(10);
    txtIdAsignado.setBounds(22, 53, 116, 25);
    txtIdAsignado.setEnabled(false);
    panelAsignado.add(txtIdAsignado);

    lblIdAsignado = new JLabel("Identificaci\u00F3n");
    lblIdAsignado.setBounds(22, 24, 116, 18);
    panelAsignado.add(lblIdAsignado);

    txtNombreAsignado = new JTextField();
    txtNombreAsignado.setColumns(10);
    txtNombreAsignado.setEnabled(false);
    txtNombreAsignado.setBounds(185, 53, 170, 25);
    panelAsignado.add(txtNombreAsignado);

    lblNombreAsignado = new JLabel("Nombre");
    lblNombreAsignado.setBounds(185, 24, 85, 18);
    panelAsignado.add(lblNombreAsignado);

    lblApellidosAsignado = new JLabel("Apellidos");
    lblApellidosAsignado.setBounds(400, 24, 95, 18);
    panelAsignado.add(lblApellidosAsignado);

    txtApellidosAsignado = new JTextField();
    txtApellidosAsignado.setColumns(10);
    txtApellidosAsignado.setEnabled(false);
    txtApellidosAsignado.setBounds(400, 53, 170, 25);
    panelAsignado.add(txtApellidosAsignado);

    panelInfoAdicional = new JPanel();
    panelInfoAdicional.setBorder(
        new TitledBorder(
            null,
            "INFORMACI\u00D3N ADICIONAL",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panelInfoAdicional.setBounds(10, 258, 585, 111);
    panelUsuarios.add(panelInfoAdicional);
    panelInfoAdicional.setLayout(null);

    lblTipoAsistencia = new JLabel("Tipo de asistencia");
    lblTipoAsistencia.setBounds(22, 30, 158, 18);
    panelInfoAdicional.add(lblTipoAsistencia);

    cbxTipoAsistencia = new JComboBox();
    cbxTipoAsistencia.setBounds(22, 59, 158, 25);
    panelInfoAdicional.add(cbxTipoAsistencia);

    lblCalificacion = new JLabel("Calificaci\u00F3n");
    lblCalificacion.setBounds(263, 32, 118, 14);
    panelInfoAdicional.add(lblCalificacion);

    cbxCalificacion = new JComboBox();
    cbxCalificacion.setBounds(263, 59, 135, 25);
    panelInfoAdicional.add(cbxCalificacion);

    panelOperaciones = new JPanel();
    panelOperaciones.setBorder(
        new TitledBorder(null, "OPERACIONES", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelOperaciones.setBounds(10, 396, 585, 80);
    panelUsuarios.add(panelOperaciones);
    panelOperaciones.setLayout(null);

    btnGuardar = new JButton("Guardar");
    btnGuardar.setBounds(335, 30, 89, 25);
    btnGuardar.addActionListener(this);
    panelOperaciones.add(btnGuardar);

    btnBorrarCampos = new JButton("Borrar campos");
    btnBorrarCampos.setBounds(156, 30, 123, 25);
    btnBorrarCampos.addActionListener(this);
    panelOperaciones.add(btnBorrarCampos);

    Val.tipoIncidente(jcbTipoRequerimiento);
    Val.tipoAsistencia(cbxTipoAsistencia);
    Val.calificacion(cbxCalificacion);
    Val.prioridad(jcbNivelRequerimiento);
    Val.estados(jcbEstado);
    Val.bloquarPaneles(
        chbNoprende,
        chbReinicia,
        chbArchivosPerdidos,
        chbBloqueo,
        chbSinAudio,
        chbMensaje,
        chbSinRed,
        chbOtrosTec,
        chbMonitor,
        chbMouse,
        chbTeclado,
        chbRegulador,
        chbParlantes,
        chbUnidadCdDvd,
        chbPuertoUsb,
        chbOtroHard,
        chbAntivirus,
        chbDriver,
        chbOfice,
        chbTodos,
        chbOtrosInsta,
        jcbTipoRequerimiento);

    panelIncidentesHistorial = new JPanel();
    panelIncidentesHistorial.setBounds(163, 29, 709, 527);
    getContentPane().add(panelIncidentesHistorial);
    panelIncidentesHistorial.setLayout(null);
    panelIncidentesHistorial.setVisible(false);

    Dtm =
        new DefaultTableModel(
            DatosIncidentes,
            new String[] {
              "C\u00F3digo incidente",
              "Clave unica",
              "Fecha incidente",
              "Cliente",
              "Prioridad",
              "Estado"
            }) {
          boolean[] columnEditables = new boolean[] {false, false, false, false, false, false};

          public boolean isCellEditable(int row, int column) {
            return columnEditables[column];
          }
        };

    JPanel consultarIncidentes = new JPanel();
    consultarIncidentes.setBorder(
        new TitledBorder(
            null, "CONSULTAR INCIDENTES", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    consultarIncidentes.setBounds(0, 0, 699, 516);
    panelIncidentesHistorial.add(consultarIncidentes);
    consultarIncidentes.setLayout(null);

    panelIncidentes = new JPanel();
    panelIncidentes.setBounds(15, 21, 673, 232);
    consultarIncidentes.add(panelIncidentes);
    panelIncidentes.setBorder(
        new TitledBorder(null, "INCIDENTES", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelIncidentes.setLayout(null);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(15, 30, 641, 183);
    panelIncidentes.add(scrollPane);
    tablaIncidentes = new JTable();
    scrollPane.setViewportView(tablaIncidentes);
    tablaIncidentes.setModel(Dtm);

    JPanel panelHistorial = new JPanel();
    panelHistorial.setBounds(15, 264, 672, 242);
    consultarIncidentes.add(panelHistorial);
    panelHistorial.setBorder(
        new TitledBorder(null, "HISTORIAL", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelHistorial.setLayout(null);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(15, 24, 640, 207);
    panelHistorial.add(scrollPane_1);
    tablaHistorial = new JTable();
    tablaHistorial.setModel(
        new DefaultTableModel(
            new Object[][] {},
            new String[] {
              "Clave unica",
              "Modificaci\u00F3n #",
              "Fecha incidencia",
              "Empleado",
              "Prioridad",
              "Estado"
            }) {
          boolean[] columnEditables = new boolean[] {false, false, false, false, false, false};

          public boolean isCellEditable(int row, int column) {
            return columnEditables[column];
          }
        });
    tablaHistorial.getColumnModel().getColumn(0).setPreferredWidth(96);
    tablaHistorial.getColumnModel().getColumn(1).setPreferredWidth(90);
    tablaHistorial.getColumnModel().getColumn(2).setPreferredWidth(97);
    tablaHistorial.getColumnModel().getColumn(3).setPreferredWidth(205);
    scrollPane_1.setViewportView(tablaHistorial);
    tablaIncidentes.addMouseListener(this);
    tablaIncidentes.getColumnModel().getColumn(0).setPreferredWidth(95);
    tablaIncidentes.getColumnModel().getColumn(2).setPreferredWidth(90);
    tablaIncidentes.getColumnModel().getColumn(3).setPreferredWidth(205);

    Dtm2 =
        new DefaultTableModel(
            DatosIncidentesConsul,
            new String[] {
              "C\u00F3digo incidente",
              "Modificaci\u00F3n #",
              "Fecha incidencia",
              "Empleado",
              "Prioridad",
              "Estado"
            }) {
          boolean[] columnEditables = new boolean[] {false, false, false, false, false, false};

          public boolean isCellEditable(int row, int column) {
            return columnEditables[column];
          }
        };

    setVisible(true);
    // panelSostenedor.setVisible(false);
  }
コード例 #17
0
  public void initComponents() {

    allowedRoles = new String[] {"*"};
    idLabel = new JLabel("ID");
    vendorLabel = new JLabel("Vendor");
    currencyLabel = new JLabel("Currency");
    facilityLabel = new JLabel("Facility");

    modifyJButton = new TooltipJButton("modify");
    modifyJButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            modifyTableContent();
          }
        });
    modifyJButton.setBounds(420, 90, 75, 20);

    vendorLookup = new TooltipJButton("Lookup");
    vendorLookup.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            vendorSearch();
          }
        });
    facilityLookup = new TooltipJButton("Lookup");
    facilityLookup.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            facilitySearch();
          }
        });
    copyButton = new TooltipJButton("copy");
    copyButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            copy();
          }
        });
    importLabel = new JLabel("import");
    durationFromLabel = new JLabel("Valid From");
    durationToLabel = new JLabel("Valid To");
    idTextField = new ContextJTextField(this);
    vendor = new ContextJTextField(this, true);
    currency = new CurrencyBox(this, true);

    facility = new ContextJTextField(this, true);
    durationFromTextField = new DateJTextField(this, true);
    mandatoryFields.add(durationFromTextField);
    durationToTextField = new DateJTextField(this, true);
    mandatoryFields.add(durationToTextField);
    bargeTariffTable = new ComposedContextJTable();
    bargeTariffTable.setColorable(true);
    importCheckBox = new ImportExportPane(this);

    mandatoryFields.add(vendor);
    mandatoryFields.add(currency);
    mandatoryFields.add(facility);
    mandatoryFields.add(durationFromTextField);
    mandatoryFields.add(durationToTextField);

    scrollpane = new JScrollPane();
    scrollpane.setBounds(10, 120, 490, 200);

    bargeTariffTable.setBounds(0, 0, 400, 400);

    idLabel.setBounds(10, 10, 40, 20);
    idTextField.setBounds(100, 10, 100, 20);
    durationFromLabel.setBounds(10, 35, 80, 20);
    durationFromTextField.setBounds(100, 35, 100, 20);
    durationToLabel.setBounds(10, 60, 80, 20);
    durationToTextField.setBounds(100, 60, 100, 20);

    // importLabel.setBounds(10, 90, 40, 20);
    importCheckBox.setBounds(10, 90, 200, 25);

    vendorLabel.setBounds(220, 10, 80, 20);
    vendor.setBounds(300, 10, 100, 20);
    vendorLookup.setBounds(420, 10, 80, 20);

    currencyLabel.setBounds(220, 60, 80, 20);
    currency.setBounds(300, 60, 100, 20);

    facilityLabel.setBounds(220, 35, 80, 20);
    facility.setBounds(300, 35, 100, 20);
    facilityLookup.setBounds(420, 35, 80, 20);

    copyButton.setBounds(345, 90, 75, 20);
    panel.setLayout(null);
    panel.setSize(700, 215);
    panel.setMinimumSize(new Dimension(700, 130));
    panel.add(idLabel);
    panel.add(idTextField);
    panel.add(durationFromLabel);
    panel.add(durationFromTextField);
    panel.add(durationToLabel);
    panel.add(durationToTextField);
    panel.add(importLabel);
    panel.add(importCheckBox);
    panel.add(vendorLabel);
    panel.add(vendor);
    panel.add(vendorLookup);
    panel.add(currencyLabel);
    panel.add(currency);
    panel.add(facilityLabel);
    panel.add(facility);
    panel.add(facilityLookup);
    panel.add(copyButton);
    panel.add(modifyJButton);

    // tabbed pane
    tabPane = new JTabbedPane();
    tabPane.setBounds(10, 175, 870, 200);
    tabPane.add("Tarifflines", scrollpane);

    // VERSION_TOGGLE Tariff.2ExtraSurcharges Start ----------
    if (ResourceUtil.getBoolean("Tariff.2ExtraSurcharges")) {
      surchargesPanel = new SurchargesPanel((Tariff) getModel());
      tabPane.add("Surcharges", surchargesPanel);
    }
    // VERSION_TOGGLE Tariff.2ExtraSurcharges End ----------

    scrollpane.getViewport().add(bargeTariffTable);
    JSplitPane splitp = new JSplitPane();
    splitp.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitp.setLeftComponent(panel);
    splitp.setRightComponent(tabPane);
    splitp.setDividerSize(0);
    getContentPane().add(splitp);
    pack();
  }
コード例 #18
0
  /** Create the frame. */
  public PdfToImage() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 443);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 0, 410, 395);
    contentPane.add(tabbedPane);

    JPanel panel = new JPanel();
    tabbedPane.addTab("New tab", null, panel, null);
    panel.setLayout(null);

    JScrollPane jScrollPane1 = new JScrollPane();
    jScrollPane1.setBounds(12, 12, 277, 344);
    panel.add(jScrollPane1);

    JButton btnNewButton = new JButton("New button");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {

              String INPUTFILE = "example.pdf";
              File file = new File(INPUTFILE);
              RandomAccessFile raf = new RandomAccessFile(file, "r");
              FileChannel channel = raf.getChannel();
              ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
              PDFFile pdffile = new PDFFile(buf);

              // draw the first page to an image
              int num = pdffile.getNumPages();
              for (int i = 0; i <= num; i++) {
                System.out.println(i);
                // draw the first page to an image
                PDFPage page = pdffile.getPage(i);

                // get the width and height for the doc at the default zoom
                Rectangle rect =
                    new Rectangle(
                        0, 0, (int) page.getBBox().getWidth(), (int) page.getBBox().getHeight());

                // generate the image
                Image img =
                    page.getImage(
                        rect.width,
                        rect.height, // width & height
                        rect, // clip rect
                        null, // null for the ImageObserver
                        true, // fill background with white
                        true // block until drawing is done
                        );
                imgPDF = img;
              }
              imagePDFicon = new ImageIcon(imgPDF);
              jScrollPane1.setViewportView(new JLabel(imagePDFicon));
            } catch (Exception err) {
              System.out.println(err);
            }
          }
        });
    btnNewButton.setBounds(304, 12, 73, 25);
    panel.add(btnNewButton);
  }
コード例 #19
0
ファイル: Network_Client_UI.java プロジェクト: gaohaoning/im
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(10, 10, 760, 430);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);
    frame.setTitle("Client");

    // JScrollPane 是 JTextArea 的容器
    textArea = new JTextArea();
    textArea.setEditable(false);
    textArea.setBackground(Color.LIGHT_GRAY);
    textArea.setAutoscrolls(true);

    scrollPane = new JScrollPane(textArea);
    scrollPane.setAutoscrolls(true);
    scrollPane.setAutoscrolls(true);
    // JScrollPane 是 JTextArea 的容器
    textArea_Chat = new JTextArea();
    textArea_Chat.setEditable(false);
    textArea_Chat.setBackground(Color.LIGHT_GRAY);
    textArea_Chat.setAutoscrolls(true);

    scrollPane_Chat = new JScrollPane(textArea_Chat);
    scrollPane_Chat.setAutoscrolls(true);
    scrollPane_Chat.setAutoscrolls(true);
    tabbedPane_Info = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane_Info.setBounds(10, 10, 500, 300);
    frame.getContentPane().add(tabbedPane_Info);

    tabbedPane_Info.addTab("信息", null, scrollPane, null);
    tabbedPane_Info.addTab("会话", null, scrollPane_Chat, null);
    tabbedPane_Info.setSelectedComponent(scrollPane_Chat); // 客户端默认只显示会话信息

    // JList 是 DefaultListModel 的容器
    defaultListModel_online = new DefaultListModel();
    defaultListModel_online.addElement("在线用户列表");
    list_online = new JList(defaultListModel_online);
    list_online.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list_online.setBackground(Color.LIGHT_GRAY);
    list_online.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            //				int index=list.getSelectedIndex();
            //				String string_ListModel=defaultListModel.elementAt(index).toString();
            //				String temp[]=string_ListModel.split(":");
            //				String clientID=temp[0];
            //				String clientName=temp[1];
            //
            //	textArea_recieverID.setText(clientID+":"+clientName+":"+"["+Integer.toString(index)+"]");

            int index = list_online.getSelectedIndex();
            String string_ID_Name =
                network_Client.get_Client_ID_Name_from_Str_Online_By_Index(index);
            textArea_recieverID.setText(string_ID_Name + ":" + "[" + Integer.toString(index) + "]");
          }
        });
    list_online.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {}
        });

    scrollPane_online = new JScrollPane(list_online);
    scrollPane_online.setAutoscrolls(true);
    scrollPane_online.setAutoscrolls(true);
    // JList 是 DefaultListModel 的容器
    defaultListModel_reg = new DefaultListModel();
    defaultListModel_reg.addElement("注册用户列表");
    list_reg = new JList(defaultListModel_reg);
    list_reg.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list_reg.setBackground(Color.LIGHT_GRAY);
    list_reg.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            //				int index=list_reg.getSelectedIndex();
            //				String string_ListModel=defaultListModel_reg.elementAt(index).toString();
            //				String temp[]=string_ListModel.split(":");
            //				String clientID=temp[0];
            //				String clientName=temp[1];
            //
            //	textArea_recieverID.setText(clientID+":"+clientName+":"+"["+Integer.toString(index)+"]");

            int index = list_reg.getSelectedIndex();
            String string_ID_Name = network_Client.get_Client_ID_Name_from_Str_Reg_By_Index(index);
            textArea_recieverID.setText(string_ID_Name + ":" + "[" + Integer.toString(index) + "]");
          }
        });
    list_reg.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {}
        });

    scrollPane_reg = new JScrollPane(list_reg);
    scrollPane_reg.setAutoscrolls(true);
    scrollPane_reg.setAutoscrolls(true);
    tabbedPane_List = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane_List.setBounds(520, 10, 220, 300);
    frame.getContentPane().add(tabbedPane_List);

    tabbedPane_List.addTab("在线用户", null, scrollPane_online, null);
    tabbedPane_List.addTab("注册用户", null, scrollPane_reg, null);
    textField_send = new JTextField();
    textField_send.setBounds(10, 320, 380, 30);
    frame.getContentPane().add(textField_send);
    textField_send.setColumns(10);
    // textField_send.setText("这是一个客户端单播测试");

    button_send = new JButton("发送明文");
    button_send.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // textField_send.setText(msg_send.recieverID);//测试获取的 recieverID OK

            Msg msg_send = new Msg(Msg_Type.chat);
            msg_send.msg_Content = textField_send.getText();
            msg_send.senderID = network_Client.login_Info.id_login;
            msg_send.recieverID = get_ReceiverID_from_textArea_recieverID(); // 此函数中【判断接收者是否为空】

            msg_send.senderName = network_Client.client_Info_Local.Name;
            msg_send.recieverName = get_ReceiverName_from_textArea_recieverID();

            if (!msg_send.recieverID.equals("")) // 【接收者】不为空才发送消息
            {
              // 先在本地显示
              String str_chat =
                  "["
                      + msg_send.senderID
                      + ":"
                      + msg_send.senderName
                      + "]对["
                      + msg_send.recieverID
                      + ":"
                      + msg_send.recieverName
                      + "]说 : "
                      + msg_send.msg_Content;
              show(str_chat);
              show_Chat(str_chat);
              // 再发送至服务器
              network_Client.send_Msg(msg_send); // 发送聊天信息
            } else {
              // 提示【接收者】为空//已经提示过了
              // network_Client.show_Inf_UI_Dialog("请指定消息接收对象");
            }
            textField_send.setText(""); // 输入框清空
            frame.getRootPane().setDefaultButton(button_send); // 按钮获取焦点
          }
        });
    button_send.setBounds(410, 320, 100, 30);
    frame.getContentPane().add(button_send);

    textField_send_codec = new JTextField();
    textField_send_codec.setBounds(10, 360, 380, 30);
    frame.getContentPane().add(textField_send_codec);
    textField_send_codec.setColumns(10);
    textField_send_codec.setText("这是一个客户端单播测试");
    textField_send_codec.setText("ILOVEYOUTOO");

    button_send_codec = new JButton("发送密文");
    button_send_codec.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {}
        });
    button_send_codec.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // (1)先检查本地密钥 key_Codec_Local 是否已经设置 未设置时值为 "$"
            // if(network_Client.key_Codec_Local.equals("$"))
            if (network_Client.key_Codec_Local == null) {
              // network_Client.show_UI_Dialog("编码策略尚未设置,请在[更新用户信息]中设置并通告服务器");
              network_Client.show_Msg("", "编码策略尚未设置,请在[更新用户信息]中设置并通告服务器");
            } else {
              // (2)再检测接受者是否为空
              if (!get_ReceiverID_from_textArea_recieverID().equals("")) // 【接收者】不为空才发送消息
              {
                // (3)再检查密钥策略是否合法
                if (network_Client.codec.check_codepolicy(network_Client.key_Codec_Local)) {
                  // 这才能建立消息 msg_send
                  Msg msg_send = new Msg();
                  msg_send.msg_Type = Msg_Type.chat_codec;
                  msg_send.senderID = network_Client.login_Info.id_login;
                  msg_send.recieverID =
                      get_ReceiverID_from_textArea_recieverID(); // 此函数中【判断接收者是否为空】
                  msg_send.senderName = network_Client.client_Info_Local.Name;
                  msg_send.recieverName = get_ReceiverName_from_textArea_recieverID();
                  msg_send.key_Codec = network_Client.key_Codec_Local;

                  msg_send.msg_Content =
                      network_Client.codec.Code(
                          network_Client.key_Codec_Local,
                          textField_send_codec.getText()); // 编码里边有检测过滤信息内容的功能

                  // 先在本地显示
                  // String str_chat="["+msg_send.senderID+"]对["+msg_send.recieverID+"]说 :
                  // "+msg_send.msg_Content;
                  String str_chat =
                      "["
                          + msg_send.senderID
                          + ":"
                          + msg_send.senderName
                          + "]对["
                          + msg_send.recieverID
                          + ":"
                          + msg_send.recieverName
                          + "]说 : "
                          + textField_send_codec.getText()
                          + "[已加密]";

                  show(str_chat);
                  show("发送密文: " + msg_send.msg_Content);
                  show_Chat(str_chat);

                  // 再发送至服务器
                  network_Client.send_Msg(msg_send); // 发送聊天信息

                  // textField_send_codec.setText("");//输入框清空
                  textField_send_codec.requestFocusInWindow(); // 输入框获取焦点
                } else {
                  // network_Client.show_UI_Dialog("加密策略不合法");
                  network_Client.show_Msg("", "加密策略不合法");
                }
              } else {
                // 提示【接收者】为空//已经提示过了
                // network_Client.show_Inf_UI_Dialog("请指定消息接收对象");
              }
            }
            textField_send_codec.setText(""); // 输入框清空
            frame.getRootPane().setDefaultButton(button_send_codec); // 按钮获取焦点
          }
        });
    button_send_codec.setBounds(410, 360, 100, 30);
    frame.getContentPane().add(button_send_codec);

    textArea_recieverID = new JTextArea();
    textArea_recieverID.setEditable(false);
    textArea_recieverID.setBackground(Color.LIGHT_GRAY);
    textArea_recieverID.setAutoscrolls(true);
    textArea_recieverID.setBounds(520, 320, 220, 30);
    // textArea_recieverID.setText("接收者");
    frame.getContentPane().add(textArea_recieverID);
    button_Edit = new JButton("更新用户信息");
    button_Edit.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            network_Client.on_Btn_Edit();
          }
        });
    button_Edit.setBounds(520, 360, 220, 30);
    frame.getContentPane().add(button_Edit);
    // 初始状态让 [发送明文按钮]获取焦点
    frame.getRootPane().setDefaultButton(button_send); // 按钮获取焦点
  }
コード例 #20
0
ファイル: PanelAdmin.java プロジェクト: mpandullo/ZombieRush
  // Constructor
  public PanelAdmin(UsuarioAdmin usuario) {
    this.usuario = usuario;

    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent arg0) {
            salir();
          }
        });
    setTitle("Zombie Rush - Panel Administrador");
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    setBounds(100, 100, 773, 405);
    getContentPane().setLayout(null);
    setLocationRelativeTo(null);
    setResizable(false);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 0, 767, 379);
    getContentPane().add(tabbedPane);

    // Panel de Usuarios
    JPanel panelUsuarios = new JPanel();
    tabbedPane.addTab("Usuarios", null, panelUsuarios, null);
    panelUsuarios.setLayout(null);

    JButton btnAgregar = new JButton("Agregar");
    btnAgregar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            crearModalRegistro();
          }
        });
    btnAgregar.setBounds(238, 316, 89, 23);
    panelUsuarios.add(btnAgregar);

    JButton btnEditar = new JButton("Editar");
    btnEditar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            editarUsuario();
          }
        });
    btnEditar.setBounds(337, 316, 89, 23);
    panelUsuarios.add(btnEditar);

    JButton btnEliminar = new JButton("Eliminar");
    btnEliminar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            eliminarUsuario();
          }
        });
    btnEliminar.setBounds(436, 316, 89, 23);
    panelUsuarios.add(btnEliminar);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(0, 0, 762, 300);
    panelUsuarios.add(scrollPane);

    // Tabla Usuarios
    tablaUsuarios = new JTable();
    tablaUsuarios.setFont(new Font("Verdana", Font.PLAIN, 11));
    // cargarUsuarios();
    tablaUsuarios.setModel(
        new DefaultTableModel(
            new Object[][] {
              {
                "Pepe24",
                new Integer(5),
                new Integer(48),
                "10/11/2014 10:23:34",
                "06/06/2015 14:22:41"
              },
              {
                "Lola", new Integer(2), new Integer(4), "14/03/2015 15:35:55", "21/05/2015 23:58:14"
              },
            },
            new String[] {
              "Nombre de Usuario",
              "Partidas Jugadas",
              "Cantidad de Puntos",
              "Creado",
              "Ultimo Acceso"
            }) {
          Class[] columnTypes =
              new Class[] {String.class, Integer.class, Integer.class, Object.class, Object.class};

          public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
          }
        });
    tablaUsuarios.getColumnModel().getColumn(0).setResizable(false);
    tablaUsuarios.getColumnModel().getColumn(0).setPreferredWidth(150);
    tablaUsuarios.getColumnModel().getColumn(0).setMinWidth(150);
    tablaUsuarios.getColumnModel().getColumn(0).setMaxWidth(150);
    tablaUsuarios.getColumnModel().getColumn(1).setResizable(false);
    tablaUsuarios.getColumnModel().getColumn(1).setPreferredWidth(110);
    tablaUsuarios.getColumnModel().getColumn(1).setMinWidth(110);
    tablaUsuarios.getColumnModel().getColumn(1).setMaxWidth(110);
    tablaUsuarios.getColumnModel().getColumn(2).setResizable(false);
    tablaUsuarios.getColumnModel().getColumn(2).setPreferredWidth(120);
    tablaUsuarios.getColumnModel().getColumn(2).setMinWidth(120);
    tablaUsuarios.getColumnModel().getColumn(2).setMaxWidth(120);
    tablaUsuarios.getColumnModel().getColumn(3).setResizable(false);
    tablaUsuarios.getColumnModel().getColumn(3).setPreferredWidth(140);
    tablaUsuarios.getColumnModel().getColumn(3).setMinWidth(140);
    tablaUsuarios.getColumnModel().getColumn(3).setMaxWidth(140);
    tablaUsuarios.getColumnModel().getColumn(4).setResizable(false);
    tablaUsuarios.getColumnModel().getColumn(4).setPreferredWidth(110);
    tablaUsuarios.getColumnModel().getColumn(4).setMinWidth(110);
    scrollPane.setViewportView(tablaUsuarios);

    // Panel Partidas
    JPanel panelPartidas = new JPanel();
    tabbedPane.addTab("Partidas", null, panelPartidas, null);
    panelPartidas.setLayout(null);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(0, 0, 762, 300);
    panelPartidas.add(scrollPane_1);

    JButton btnAgregar_1 = new JButton("Agregar");
    btnAgregar_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            crearModalPartida();
          }
        });
    btnAgregar_1.setBounds(238, 316, 89, 23);
    panelPartidas.add(btnAgregar_1);

    JButton btnEditar_1 = new JButton("Editar");
    btnEditar_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            crearModalEditarPartida();
          }
        });
    btnEditar_1.setBounds(337, 316, 89, 23);
    panelPartidas.add(btnEditar_1);

    JButton btnEliminar_1 = new JButton("Eliminar");
    btnEliminar_1.setBounds(436, 316, 89, 23);
    panelPartidas.add(btnEliminar_1);

    // Tabla Partidas
    tablaPartidas = new JTable();
    tablaPartidas.setModel(
        new DefaultTableModel(
            new Object[][] {
              {
                "Apocalipsis Now",
                "Activo",
                new Integer(5),
                new Integer(20),
                new Integer(8),
                new Integer(124),
                "21:57"
              },
              {
                "Comiendo Cerebros",
                "En espera",
                new Integer(10),
                new Integer(30),
                new Integer(4),
                new Integer(15),
                "05:45"
              },
            },
            new String[] {
              "Nombre Partida",
              "Estado",
              "Min Jugadores",
              "Max Jugadores",
              "Cantidad Jugadores",
              "Puntos",
              "Tiempo de Juego(mm:ss)"
            }) {
          Class[] columnTypes =
              new Class[] {
                String.class,
                String.class,
                Integer.class,
                Integer.class,
                Integer.class,
                Integer.class,
                String.class
              };

          public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
          }
        });
    tablaPartidas.getColumnModel().getColumn(0).setPreferredWidth(160);
    tablaPartidas.getColumnModel().getColumn(0).setMinWidth(160);
    tablaPartidas.getColumnModel().getColumn(0).setMaxWidth(160);
    tablaPartidas.getColumnModel().getColumn(1).setPreferredWidth(70);
    tablaPartidas.getColumnModel().getColumn(1).setMinWidth(70);
    tablaPartidas.getColumnModel().getColumn(1).setMaxWidth(70);
    tablaPartidas.getColumnModel().getColumn(2).setPreferredWidth(85);
    tablaPartidas.getColumnModel().getColumn(2).setMinWidth(85);
    tablaPartidas.getColumnModel().getColumn(2).setMaxWidth(85);
    tablaPartidas.getColumnModel().getColumn(3).setPreferredWidth(85);
    tablaPartidas.getColumnModel().getColumn(3).setMinWidth(85);
    tablaPartidas.getColumnModel().getColumn(3).setMaxWidth(85);
    tablaPartidas.getColumnModel().getColumn(4).setPreferredWidth(120);
    tablaPartidas.getColumnModel().getColumn(4).setMinWidth(120);
    tablaPartidas.getColumnModel().getColumn(4).setMaxWidth(120);
    tablaPartidas.getColumnModel().getColumn(5).setPreferredWidth(45);
    tablaPartidas.getColumnModel().getColumn(5).setMinWidth(45);
    tablaPartidas.getColumnModel().getColumn(5).setMaxWidth(45);
    scrollPane_1.setViewportView(tablaPartidas);

    // Panel Estadisticas
    JPanel panelEstadisticas = new JPanel();
    tabbedPane.addTab("Estadisticas", null, panelEstadisticas, null);
    panelEstadisticas.setLayout(null);

    JComboBox comboJuegos = new JComboBox();
    comboJuegos.setFont(new Font("Verdana", Font.PLAIN, 12));
    comboJuegos.setModel(
        new DefaultComboBoxModel(
            new String[] {"Apocalipsis Now", "Comiendo Cerebros", "The Walking Dead"}));
    comboJuegos.setBounds(168, 14, 163, 20);
    panelEstadisticas.add(comboJuegos);

    JLabel lblSeleccioneUnJuego = new JLabel("Seleccione un Juego:");
    lblSeleccioneUnJuego.setFont(new Font("Verdana", Font.PLAIN, 13));
    lblSeleccioneUnJuego.setBounds(10, 14, 148, 17);
    panelEstadisticas.add(lblSeleccioneUnJuego);

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(10, 42, 750, 300);
    panelEstadisticas.add(scrollPane_2);

    JTextArea txtrEstadoActivoCantidad = new JTextArea();
    txtrEstadoActivoCantidad.setText(
        "Estado: activo\r\nCantidad m\u00EDnima de Jugadores: 5\r\nCantidad m\u00E1xima de Jugadores: 10\r\nCantidad de Jugadores: 8\r\n\r\nTiempo de Juego(mm:ss): 20:00\r\n\r\nPuntos Acumulados: 124\r\nPuntos por Usuario:\r\nPepe24: 29\r\nLola: 5\r\n.\r\n.\r\n.\r\n\r\nMovimientos:\r\nPepe24: derecha\r\nLola: abajo\r\n.\r\n.\r\n.\r\n");
    scrollPane_2.setViewportView(txtrEstadoActivoCantidad);
  }
コード例 #21
0
  /** 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);
  }
コード例 #22
0
  private void initComponents() { // GEN-BEGIN:initComponents

    // COMPONENTES DE LA PESTAÑA 1
    jPanel1 = new javax.swing.JPanel();
    PanelP = new javax.swing.JPanel();

    jButton1 = new javax.swing.JButton(); // linea 2
    jButton2 = new javax.swing.JButton();

    jEtiq1 = new javax.swing.JLabel();
    jEtiq2 = new javax.swing.JLabel();
    jEtiq3 = new javax.swing.JLabel();
    jEtiq4 = new javax.swing.JLabel();
    jEtiq5 = new javax.swing.JLabel();

    // Se crea el scroll para el área de texto de los vectores
    vectores = new javax.swing.JTextArea(null, 0, 0);
    help = new javax.swing.JEditorPane();
    help.setEditable(false);

    scroll = new javax.swing.JScrollPane(vectores);
    scroll2 = new javax.swing.JScrollPane(help);

    tvariables = new javax.swing.JTextField();
    texpresion = new javax.swing.JTextField();
    tconstantes = new javax.swing.JTextField();

    TabFolders = new javax.swing.JTabbedPane();

    // COMPONENTES DE LA PESTAÑA 2
    buttonGroup1 = new javax.swing.ButtonGroup();
    buttonGroup2 = new javax.swing.ButtonGroup();
    PanelP = new javax.swing.JPanel();
    Label1 = new javax.swing.JLabel();
    Label2 = new javax.swing.JLabel();
    Label3 = new javax.swing.JLabel();
    tConstantes = new javax.swing.JTextField();
    tVariables = new javax.swing.JTextField();
    tExpresion = new javax.swing.JTextField();
    Panel2 = new javax.swing.JPanel();
    Label4 = new javax.swing.JLabel();
    Etiq = new javax.swing.JLabel();
    Label5 = new javax.swing.JLabel();
    Label6 = new javax.swing.JLabel();
    Label7 = new javax.swing.JLabel();
    rECM = new javax.swing.JRadioButton();
    rKS = new javax.swing.JRadioButton();
    Label8 = new javax.swing.JLabel();
    Label9 = new javax.swing.JLabel();
    Label10 = new javax.swing.JLabel();
    Label11 = new javax.swing.JLabel();
    Label12 = new javax.swing.JLabel();
    Label13 = new javax.swing.JLabel();
    Label14 = new javax.swing.JLabel();
    rAutomatico = new javax.swing.JRadioButton();
    rArchivo = new javax.swing.JRadioButton();
    Label15 = new javax.swing.JLabel();
    Label16 = new javax.swing.JLabel();
    tCruce = new javax.swing.JTextField();
    tMutacion = new javax.swing.JTextField();
    tPoblacion = new javax.swing.JTextField();
    tGeneraciones = new javax.swing.JTextField();
    tEntrada = new javax.swing.JTextField();
    tSalida = new javax.swing.JTextField();
    tValmin = new javax.swing.JTextField();
    tValmax = new javax.swing.JTextField();
    tValarchivo = new javax.swing.JTextField();
    Label17 = new javax.swing.JLabel();
    tErrormin = new javax.swing.JTextField();
    tErrormax = new javax.swing.JTextField();
    tDelta = new javax.swing.JTextField();
    tKS = new javax.swing.JTextField();
    bEvolucion = new javax.swing.JButton();
    barra = new javax.swing.JProgressBar();

    // UBICACION DE LOS COMPONENTES DE LA PRIMERA PESTAÑA
    getContentPane().setLayout(null);
    // getContentPane().setBackground(new java.awt.Color(255,195,140));

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Parámetros de Entrada Para el Simulador");
    setResizable(false);

    jPanel1.setLayout(null);

    jPanel1.setBackground(new java.awt.Color(240, 240, 240));
    jPanel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(100, 100, 100)));
    jEtiq1.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 12));
    jEtiq1.setText("Función :");
    jPanel1.add(jEtiq1);
    jEtiq1.setBounds(30, 45, 70, 13);

    jEtiq2.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 12));
    jEtiq2.setText("Variables: ");
    jPanel1.add(jEtiq2);
    jEtiq2.setBounds(30, 79, 70, 13);

    jEtiq3.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 11));
    jEtiq3.setText("Constantes: ");
    jPanel1.add(jEtiq3);
    jEtiq3.setBounds(25, 109, 72, 19);

    jEtiq4.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 12));
    jEtiq4.setText("  Vectores");
    jPanel1.add(jEtiq4);
    jEtiq4.setBounds(30, 145, 80, 13);

    jEtiq5.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 12));
    jEtiq5.setText("  Iniciales:");
    jPanel1.add(jEtiq5);
    jEtiq5.setBounds(30, 165, 80, 13);

    tconstantes.setFont(new java.awt.Font("Arial", 1, 13));
    tconstantes.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    jPanel1.add(tconstantes);
    tconstantes.setBounds(100, 110, 240, 23);
    tconstantes.setText("");

    tvariables.setFont(new java.awt.Font("Arial", 1, 13));
    tvariables.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    jPanel1.add(tvariables);
    tvariables.setBounds(100, 75, 240, 23);
    tvariables.setText("");

    texpresion.setFont(new java.awt.Font("Arial", 1, 11));
    texpresion.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    jPanel1.add(texpresion);
    texpresion.setBounds(100, 40, 240, 23);
    texpresion.setText("");

    vectores.setFont(new java.awt.Font("Arial", 1, 14));
    scroll.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    jPanel1.add(scroll);
    scroll.setBounds(100, 145, 240, 193);
    vectores.setText("");

    // AREA DONDE SE LE MUESTRAN LOS COMENTARIOS DE AYUDA AL USUARIO
    help.setFont(new java.awt.Font("Times New Roman", 2, 13));
    help.setBackground(new java.awt.Color(240, 240, 240));
    help.setBounds(390, 52, 204, 294);
    scroll2.setBackground(new java.awt.Color(240, 240, 240));
    scroll2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    scroll2.setAutoscrolls(true);
    //        scroll2.setCorner(this,1);
    jPanel1.add(scroll2);
    scroll2.setBounds(360, 40, 206, 298);
    letrero_inicial();

    // getContentPane().add(jPanel1);

    // DEFINE LAS DIMENSIONES DEL PANEL: x,y,ancho,altura
    // jPanel1.setBounds(40, 20, 340, 320);

    TabFolders.setBackground(new java.awt.Color(225, 225, 225));
    TabFolders.add(" Parámetros de Entrada ", jPanel1);

    // UBICACION DE LOS COMPONENTES DE LA SEGUNDA PESTAÑA
    // getContentPane().setLayout(null);
    PanelP.setLayout(null);
    PanelP.setBackground(new java.awt.Color(240, 240, 240));
    PanelP.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(100, 100, 100)));

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle(
        "Estimador de parámetros para funciones no lineales por simulación de algoritmos evolutivos");
    setResizable(false);

    Label4.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label4.setText("Probabilidad Cruce:");
    PanelP.add(Label4);
    Label4.setBounds(40, 20, 110, 13);

    Label5.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label5.setText("Probabilidad de mutaci\u00f3n:");
    PanelP.add(Label5);
    Label5.setBounds(40, 50, 130, 13);

    Label6.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label6.setText("Cantidad de poblaci\u00f3n:");
    PanelP.add(Label6);
    Label6.setBounds(40, 80, 120, 13);

    Label7.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label7.setText("N\u00famero de generaciones:");
    PanelP.add(Label7);
    Label7.setBounds(40, 110, 130, 13);

    rECM.setBackground(new java.awt.Color(240, 240, 240));
    rECM.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    rECM.setText("ECM");
    rECM.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            RECMActionPerformed(evt);
          }
        });

    PanelP.add(rECM);
    rECM.setBounds(312, 40, 49, 21);

    rKS.setBackground(new java.awt.Color(240, 240, 240));
    rKS.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    rKS.setText("Kolmogorov - Smirnov");
    rKS.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            RKSActionPerformed(evt);
          }
        });

    PanelP.add(rKS);
    rKS.setBounds(310, 60, 130, 21);

    Label8.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label8.setText("Error m\u00ednimo:");
    PanelP.add(Label8);
    Label8.setBounds(300, 120, 80, 13);

    Label9.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label9.setText("Error m\u00e1ximo:");
    PanelP.add(Label9);
    Label9.setBounds(300, 150, 70, 13);

    Label9.setVisible(false);

    Label10.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label10.setText("Delta de error:");
    PanelP.add(Label10);
    Label10.setBounds(300, 180, 80, 13);

    Label10.setVisible(false);

    Label11.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label11.setText("Porcentaje de puntos (K-S):");
    PanelP.add(Label11);
    Label11.setBounds(300, 150, 130, 13);

    /*Label12.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label12.setText("Archivo de entrada:");
    PanelP.add(Label12);
    Label12.setBounds(40, 140, 92, 13);*/

    Label13.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label13.setText("Archivo de salida:");
    PanelP.add(Label13);
    Label13.setBounds(40, 140, 100, 13);

    Label14.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10));
    Label14.setText("Calcular pobaci\u00f3n inicial ");
    PanelP.add(Label14);
    Label14.setBounds(20, 210, 220, 13);

    rAutomatico.setBackground(new java.awt.Color(240, 240, 240));
    rAutomatico.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    rAutomatico.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    rAutomatico.setText("Autom\u00e1ticamente:");
    PanelP.add(rAutomatico);
    rAutomatico.setBounds(50, 230, 130, 21);

    rArchivo.setBackground(new java.awt.Color(240, 240, 240));
    rArchivo.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    rArchivo.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    rArchivo.setText("Valores dados de archivo:");
    PanelP.add(rArchivo);
    rArchivo.setBounds(50, 300, 150, 21);

    Label15.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label15.setText("Valores entre:");
    PanelP.add(Label15);
    Label15.setBounds(60, 260, 80, 13);

    Label16.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    Label16.setText("y");
    PanelP.add(Label16);
    Label16.setBounds(210, 260, 20, 13);

    tCruce.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tCruce.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tCruce);
    tCruce.setBounds(140, 20, 110, 18);
    tCruce.setText("0.5");

    tMutacion.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tMutacion.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tMutacion);
    tMutacion.setBounds(170, 50, 80, 18);
    tMutacion.setText("0.025");

    tPoblacion.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tPoblacion.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tPoblacion);
    tPoblacion.setBounds(160, 80, 90, 18);
    tPoblacion.setText("200");

    tGeneraciones.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tGeneraciones.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tGeneraciones);
    tGeneraciones.setBounds(170, 110, 80, 18);
    tGeneraciones.setText("100");

    tEntrada.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    PanelP.add(tEntrada);
    tEntrada.setBounds(240, 140, 110, 18);
    tEntrada.setText("Entrada.txt");
    tEntrada.setVisible(false);

    tSalida.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tSalida.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tSalida);
    tSalida.setBounds(130, 140, 120, 18);
    tSalida.setText("Salida.txt");

    tValmin.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tValmin.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tValmin);
    tValmin.setBounds(140, 260, 60, 18);
    tValmin.setText("-100.0");

    tValmax.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tValmax.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tValmax);
    tValmax.setBounds(230, 260, 60, 18);
    tValmax.setText("100.0");

    tDelta.setVisible(false);

    tValarchivo.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tValarchivo.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tValarchivo);
    tValarchivo.setBounds(70, 330, 220, 18);
    tValarchivo.setText("dataDefault.txt");

    Label17.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10));
    Label17.setText("C\u00e1lculo del error:");
    PanelP.add(Label17);
    Label17.setBounds(300, 20, 100, 13);

    tErrormin.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tErrormin.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tErrormin);
    tErrormin.setBounds(440, 120, 80, 18);
    tErrormin.setText("0.0");

    tErrormax.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tErrormax.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tErrormax);
    tErrormax.setBounds(390, 150, 80, 18);
    tErrormax.setText("0.01");

    tErrormax.setVisible(false);

    tDelta.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    PanelP.add(tDelta);
    tDelta.setBounds(390, 180, 80, 18);
    tDelta.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    tDelta.setText("0.1");

    tKS.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 10));
    tKS.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));
    PanelP.add(tKS);
    tKS.setBounds(440, 150, 80, 18);
    tKS.setText("0.8");

    bEvolucion.setText("Iniciar!");
    bEvolucion.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 20));
    bEvolucion.setBackground(new java.awt.Color(210, 210, 210));
    bEvolucion.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(100, 100, 100)));

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

    tExpresion.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            TExpresionActionPerformed(e);
          }
        });

    PanelP.add(bEvolucion);
    bEvolucion.setBounds(370, 280, 150, 70);

    Etiq.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 10));
    Etiq.setBounds(345, 183, 190, 70);
    Etiq.setText("Evolución de las Generaciones:");
    PanelP.add(Etiq);
    Etiq.setVisible(false);

    barra.setBounds(370, 240, 150, 20);

    barra.setMinimum(0);
    barra.setMaximum(100);
    barra.setVisible(false);
    barra.setBackground(new java.awt.Color(240, 240, 240));
    barra.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
    PanelP.add(barra);

    buttonGroup1.add(rECM);
    buttonGroup1.add(rKS);
    rECM.setSelected(true);
    rECM.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 100, 200)));

    buttonGroup2.add(rArchivo);
    buttonGroup2.add(rAutomatico);
    rAutomatico.setSelected(true);

    TabFolders.setEnabled(true);
    TabFolders.add(" Ejecución de la Simulación ", PanelP);
    TabFolders.setBounds(40, 20, 600, 400);
    getContentPane().add(TabFolders, java.awt.BorderLayout.CENTER);

    // Se adicionan los "escuchadores" de foco a los campos de texto de la primera pestaña

    SymFocus aSymFocus = new SymFocus(this);
    texpresion.addFocusListener(aSymFocus);
    tconstantes.addFocusListener(aSymFocus);
    tvariables.addFocusListener(aSymFocus);
    vectores.addFocusListener(aSymFocus);

    pack();

    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width - 925) / 2, (screenSize.height - 582) / 2, 675, 482);
  }
コード例 #23
0
ファイル: Main.java プロジェクト: nnductuan/My-project
  /**
   * Initialize the contents of the frame.
   *
   * @throws UnknownHostException
   */
  private void initialize() throws UnknownHostException {
    frame = new JFrame("__SERVER__");
    frame.setBounds(100, 100, 519, 524);
    frame.setForeground(Color.RED);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    txtIP = new JTextField();
    txtIP.setBounds(29, 11, 86, 20);
    frame.getContentPane().add(txtIP);
    txtIP.setColumns(10);
    InetAddress myHost = InetAddress.getLocalHost();
    txtIP.setText(myHost.getHostAddress());

    txtPort = new JTextField();
    txtPort.setBounds(175, 11, 86, 20);
    frame.getContentPane().add(txtPort);
    txtPort.setColumns(10);
    txtPort.setText("5000");
    final JButton StartButtom = new JButton("Start");
    StartButtom.setBounds(307, 10, 89, 23);
    StartButtom.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.blue));
    StartButtom.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            if (StartButtom.getText().equals("Start")) {
              txtIP.disable();
              txtPort.disable();

              File file = new File("file.txt");
              FileReader fr;
              try {
                fr = new FileReader(file);
                BufferedReader br = new BufferedReader(fr);
                String line;

                while ((line = br.readLine()) != null) {
                  String[] s = line.split("__FF__");
                  FileNode node =
                      new FileNode(
                          s[1], s[2], Long.parseLong(s[3]), s[4], s[5], Integer.parseInt(s[6]));
                  mf.addFile(node);
                }
                br.close();
              } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }

              StartButtom.setText("Exit");
              StartButtom.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.red));
              int port = Integer.parseInt(txtPort.getText());
              try {
                startServer(port);
              } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
            } else {
              File file = new File("file.txt");
              BufferedWriter out;
              try {

                out = new BufferedWriter(new FileWriter(file, true));
                for (int i = 0; i < mf.listFile.size(); i++) {
                  out.append(
                      "__FF__"
                          + mf.listFile.get(i).fileName
                          + "__FF__"
                          + mf.listFile.get(i).path
                          + "__FF__"
                          + mf.listFile.get(i).size
                          + "__FF__"
                          + mf.listFile.get(i).userName
                          + "__FF__"
                          + mf.listFile.get(i).IP
                          + "__FF__"
                          + mf.listFile.get(i).port);
                  out.newLine();
                }
                out.close();
              } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }

              StartButtom.setText("Start");

              System.exit(0);
            }
          }
        });
    frame.getContentPane().add(StartButtom);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(287, 125, 109, 164);
    frame.getContentPane().add(scrollPane);

    listF = new JList();
    scrollPane.setViewportView(listF);

    JLabel lblServerFile = new JLabel("File To DownLoad");
    lblServerFile.setFont(new Font("Tahoma", Font.PLAIN, 18));
    lblServerFile.setBounds(71, 73, 151, 20);
    frame.getContentPane().add(lblServerFile);

    JLabel lblClientOnline = new JLabel("Client Online");
    lblClientOnline.setFont(new Font("Tahoma", Font.PLAIN, 18));
    lblClientOnline.setBounds(340, 73, 140, 20);
    frame.getContentPane().add(lblClientOnline);

    JLabel lblNotification = new JLabel("Notification:");
    lblNotification.setFont(new Font("Tahoma", Font.PLAIN, 13));
    lblNotification.setBounds(71, 322, 68, 18);
    frame.getContentPane().add(lblNotification);

    final JLabel mauMe = new JLabel("___GVHD: NGUYEN HONG NAM___");
    mauMe.setBounds(29, 449, 307, 25);
    frame.getContentPane().add(mauMe);

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(71, 341, 341, 97);
    frame.getContentPane().add(scrollPane_2);
    scrollPane_2.setViewportView(txtArea);

    JLabel lblNewLabel = new JLabel("IP:");
    lblNewLabel.setBounds(10, 14, 20, 14);
    frame.getContentPane().add(lblNewLabel);

    JLabel lblPort = new JLabel("Port:");
    lblPort.setBounds(144, 14, 25, 14);
    frame.getContentPane().add(lblPort);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 104, 221, 197);
    frame.getContentPane().add(tabbedPane);

    JPanel panel = new JPanel();
    tabbedPane.addTab("Client", null, panel, null);
    panel.setLayout(null);

    scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(10, 11, 180, 147);
    panel.add(scrollPane_1);

    final JList listClient = new JList();
    scrollPane_1.setViewportView(listClient);

    JPanel panel_1 = new JPanel();
    tabbedPane.addTab("Conference", null, panel_1, null);
    panel_1.setLayout(null);
    Timer timerUpdateMau = new Timer();
    TimerTask ttMau =
        new TimerTask() {
          @Override
          public void run() {
            if (mauMe.getText().equals("___3D GROUP___")) {
              mauMe.setForeground(Color.RED);
              mauMe.setText("___GVHD: NGUYEN HONG NAM___");
            } else if (mauMe.getText().equals("___GVHD: NGUYEN HONG NAM___")) {
              mauMe.setForeground(Color.MAGENTA);
              mauMe.setText("___PEER TO PEER SERVER___");
            } else if (mauMe.getText().equals("___PEER TO PEER SERVER___")) {
              mauMe.setForeground(Color.BLUE);
              mauMe.setText("___3D GROUP___");
            }
          }
        };
    timerUpdateMau.schedule(ttMau, 0, 2000);
    Timer timerUpdateListClient = new Timer();
    TimerTask tmClient =
        new TimerTask() {
          @Override
          public void run() {
            DefaultListModel<String> modelClient = new DefaultListModel<String>();
            for (int i = 0; i < mnClient.listClient.size(); i++) {
              modelClient.addElement(mnClient.listClient.get(i).username);
            }
            listClient.setModel(modelClient);
          }
        };
    timerUpdateListClient.schedule(tmClient, 0, 2000);

    Timer timerUpdateList = new Timer();
    TimerTask tt =
        new TimerTask() {
          @Override
          public void run() {
            DefaultListModel<String> model = new DefaultListModel<String>();
            for (int i = 0; i < mf.listFile.size(); i++) {
              model.addElement(mf.listFile.get(i).fileName);
            }
            listF.setModel(model);
          }
        };
    timerUpdateList.schedule(tt, 0, 2000);

    /*Timer timerUpdateFILE=new Timer();
    TimerTask tFILE = new TimerTask() {
    	@Override
    	public void run() {

    		File file = new File("file.txt");
    		file.delete();
    		BufferedWriter out;
    		try {
    			System.out.print("dang ghi file");
    			out = new BufferedWriter(new FileWriter(file, true));
    			for(int i = 0;i<mf.listFile.size();i++){
    				out.append("__FF__"+mf.listFile.get(i).fileName+"__FF__"+mf.listFile.get(i).path+"__FF__"+mf.listFile.get(i).size
    						+"__FF__"+mf.listFile.get(i).userName+"__FF__"+mf.listFile.get(i).IP+"__FF__"+mf.listFile.get(i).port);
    				out.newLine();
    			}
    			out.close();
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    	}
    };
    timerUpdateFILE.schedule(tFILE, 0,2000);*/
    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            JOptionPane.showMessageDialog(frame, "Plase click exit buttom to close window");
          }
        });
  }
コード例 #24
0
  /** Create the frame. */
  public UpdatePersonnelFrame() {
    setSize(512, 284);
    screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation(
        (screenSize.width - this.getWidth()) / 2, (screenSize.height - this.getHeight()) / 2);
    setTitle("�޸�Ա����Ϣ����");
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
    try {
      File file = new File("file.txt");
      FileInputStream fin = new FileInputStream(file);
      int count = fin.read();
      fin.close();
      file.delete();
      message = dao.selectMessageById(count);
      contact = dao.selectContactById(count);
    } catch (Exception e) {

      e.printStackTrace();
    }
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 0, 496, 246);
    contentPane.add(tabbedPane);

    JPanel panel = new JPanel();
    tabbedPane.addTab("������Ϣ", null, panel, null);
    panel.setLayout(null);

    JLabel nameLabel = new JLabel("������");
    nameLabel.setBounds(37, 24, 44, 15);
    panel.add(nameLabel);

    nameTextField = new JTextField();
    nameTextField.setText(message.getName());
    nameTextField.setBounds(85, 19, 133, 25);
    panel.add(nameTextField);
    nameTextField.setColumns(10);

    JLabel ageLabel = new JLabel("���䣺");
    ageLabel.setBounds(251, 24, 44, 15);
    panel.add(ageLabel);

    ageTextField = new JTextField();
    ageTextField.setText("" + message.getAge());
    ageTextField.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent event) { // ij������ʱ���õķ���
            char ch = event.getKeyChar(); // ��ȡ�û�������ַ�
            if ((ch < '0' || ch > '9')) { // ����û��������Ϣ��Ϊ����
              event.consume(); // �������û�����
            }
          }
        });
    ageTextField.setColumns(10);
    ageTextField.setBounds(290, 19, 133, 25);
    panel.add(ageTextField);

    JLabel sexLabel = new JLabel("�Ա�");
    sexLabel.setBounds(37, 65, 44, 15);
    panel.add(sexLabel);

    final JRadioButton manRadioButton = new JRadioButton("��");
    String sex = message.getSex();
    if (sex.equals("��")) {
      manRadioButton.setSelected(true);
    }

    manRadioButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            message.setSex(manRadioButton.getText());
          }
        });

    manRadioButton.setBounds(85, 61, 44, 23);
    panel.add(manRadioButton);

    final JRadioButton wRadioButton = new JRadioButton("Ů");
    if (sex.equals("Ů")) {
      wRadioButton.setSelected(true);
    }
    wRadioButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            message.setSex(wRadioButton.getText());
          }
        });
    wRadioButton.setBounds(131, 61, 44, 23);
    panel.add(wRadioButton);
    ButtonGroup group = new ButtonGroup();
    group.add(manRadioButton);
    group.add(wRadioButton);
    JLabel deptLabel = new JLabel("���ţ�");
    deptLabel.setBounds(251, 65, 44, 15);
    panel.add(deptLabel);
    DeptDao deptDao = new DeptDao();
    List list = deptDao.selectDept();
    String[] dName = new String[list.size()];
    for (int i = 0; i < list.size(); i++) {
      Dept dept = (Dept) list.get(i);
      dName[i] = dept.getdName();
    }
    final JComboBox deptComboBox = new JComboBox(dName);
    Dept dept = dao.selectDepotById(message.getDept());
    deptComboBox.setSelectedItem(dept.getdName());
    deptComboBox.setBounds(290, 65, 133, 21);
    panel.add(deptComboBox);

    JLabel headshipLabel = new JLabel("ְ��");
    headshipLabel.setBounds(37, 109, 44, 15);
    panel.add(headshipLabel);
    List headName = dao.selectHeadship();
    String headship[] = new String[headName.size()];
    for (int j = 0; j < headName.size(); j++) {
      Headship headshi = (Headship) headName.get(j);
      headship[j] = headshi.getHeadshipName();
    }
    final JComboBox headshipComboBox = new JComboBox(headship);
    headshipComboBox.setBounds(85, 106, 133, 21);
    panel.add(headshipComboBox);

    JButton insertutton = new JButton("�޸�");
    insertutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String name = nameTextField.getText();
            String age = ageTextField.getText();
            String dept = deptComboBox.getSelectedItem().toString();
            String headship = headshipComboBox.getSelectedItem().toString();
            int id = dao.selectIdByHeadship(headship);
            if ((name.equals("")) || (age.equals(""))) {
              JOptionPane.showMessageDialog(
                  getContentPane(),
                  "�����Ǻŵ���Ϣ��д������",
                  "��Ϣ��ʾ��",
                  JOptionPane.INFORMATION_MESSAGE);
              return;
            }
            hid = dao.selectBasicMessageByName(name);
            int ageid = Integer.parseInt(age);
            DeptDao deptDao = new DeptDao();
            Dept dpt = deptDao.selectDeptByName(dept);
            message.setName(name);
            message.setAge(ageid);
            message.setDept(dpt.getId());
            message.setHeadship(id);
            dao.updatertMessage(message);
            JOptionPane.showMessageDialog(
                getContentPane(), "����Ϣ�޸ijɹ���", "��Ϣ��ʾ��", JOptionPane.INFORMATION_MESSAGE);
          }
        });
    insertutton.setBounds(112, 163, 93, 23);
    panel.add(insertutton);

    JButton closeButton = new JButton("�ر�");
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            do_closeButton_actionPerformed(e);
          }
        });
    closeButton.setBounds(251, 163, 93, 23);
    panel.add(closeButton);

    JLabel messageLabel = new JLabel("*");
    messageLabel.setForeground(Color.RED);
    messageLabel.setBounds(228, 24, 15, 15);
    panel.add(messageLabel);

    JLabel label_1 = new JLabel("*");
    label_1.setForeground(Color.RED);
    label_1.setBounds(228, 65, 15, 15);
    panel.add(label_1);

    JLabel label_2 = new JLabel("*");
    label_2.setForeground(Color.RED);
    label_2.setBounds(433, 65, 15, 15);
    panel.add(label_2);

    JLabel label_3 = new JLabel("*");
    label_3.setForeground(Color.RED);
    label_3.setBounds(228, 109, 15, 15);
    panel.add(label_3);

    JPanel panel2 = new JPanel();
    tabbedPane.addTab("��ϵ����", null, panel2, null);
    panel2.setLayout(null);

    JLabel contactLabel = new JLabel("�ֻ���");
    contactLabel.setBounds(28, 28, 48, 15);
    panel2.add(contactLabel);

    contactTextField = new JTextField();
    contactTextField.setText(contact.getContact());
    contactTextField.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent event) { // ij������ʱ���õķ���
            char ch = event.getKeyChar(); // ��ȡ�û�������ַ�
            if ((ch < '0' || ch > '9')) { // ����û��������Ϣ��Ϊ����
              event.consume(); // �������û�����
            }
          }
        });
    contactTextField.setColumns(10);
    contactTextField.setBounds(86, 23, 133, 25);
    panel2.add(contactTextField);

    JLabel opgoneLLabel = new JLabel("�칫�绰��");
    opgoneLLabel.setBounds(233, 28, 73, 15);
    panel2.add(opgoneLLabel);

    officePhoneTextField = new JTextField();
    officePhoneTextField.setText(contact.getOfficePhone());
    officePhoneTextField.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent event) { // ij������ʱ���õķ���
            char ch = event.getKeyChar(); // ��ȡ�û�������ַ�
            if ((ch < '0' || ch > '9')) { // ����û��������Ϣ��Ϊ����
              event.consume(); // �������û�����
            }
          }
        });
    officePhoneTextField.setColumns(10);
    officePhoneTextField.setBounds(307, 23, 133, 25);
    panel2.add(officePhoneTextField);

    JLabel faxLabel = new JLabel("���棺");
    faxLabel.setBounds(28, 72, 48, 15);
    panel2.add(faxLabel);

    faxTextField = new JTextField();
    faxTextField.setText(contact.getFax());
    faxTextField.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent event) { // ij������ʱ���õķ���
            char ch = event.getKeyChar(); // ��ȡ�û�������ַ�
            if ((ch < '0' || ch > '9')) { // ����û��������Ϣ��Ϊ����
              event.consume(); // �������û�����
            }
          }
        });
    faxTextField.setColumns(10);
    faxTextField.setBounds(86, 69, 133, 25);
    panel2.add(faxTextField);

    JLabel label = new JLabel("���䣺");
    label.setBounds(257, 72, 49, 15);
    panel2.add(label);

    emailTextField = new JTextField();
    emailTextField.setText(contact.getEmail());
    emailTextField.setColumns(10);
    emailTextField.setBounds(307, 67, 133, 25);
    panel2.add(emailTextField);

    JLabel addressLabe = new JLabel("סַ��");
    addressLabe.setBounds(28, 117, 48, 15);
    panel2.add(addressLabe);

    addressTextField = new JTextField();
    addressTextField.setText(contact.getFaddress());
    addressTextField.setColumns(10);
    addressTextField.setBounds(86, 114, 133, 25);
    panel2.add(addressTextField);

    JButton insertbutton = new JButton("�޸�");
    insertbutton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Contact contact = new Contact();
            String name = nameTextField.getText();
            hid = dao.selectBasicMessageByName(name);
            contact.setHid(hid);
            contact.setContact(contactTextField.getText());
            contact.setOfficePhone(officePhoneTextField.getText());
            contact.setFax(faxTextField.getText());
            contact.setEmail(emailTextField.getText());
            contact.setFaddress(addressTextField.getText());
            dao.updatertContact(contact);

            JOptionPane.showMessageDialog(
                getContentPane(), "�����޸ijɹ���", "��Ϣ��ʾ��", JOptionPane.INFORMATION_MESSAGE);
          }
        });
    insertbutton.setBounds(126, 162, 93, 23);
    panel2.add(insertbutton);

    JButton closeButton2 = new JButton("�ر�");
    closeButton2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            do_closeButton_actionPerformed(e);
          }
        });
    closeButton2.setBounds(257, 162, 93, 23);
    panel2.add(closeButton2);
  }
コード例 #25
0
ファイル: RoboyStarmindGUI.java プロジェクト: Roboy/junior
  /** Initialize the contents of the frame. */
  private void initialize() {
    subTitleFont = new Font("Ubuntu", Font.BOLD, 16);

    frame = new JFrame();
    frame.setBounds(0, 0, 630, 850);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    // TITLE
    JLabel lblRoboyStarmind = new JLabel("Roboy Cockpit");
    lblRoboyStarmind.setBounds(12, 0, 558, 35);
    lblRoboyStarmind.setHorizontalTextPosition(JLabel.LEFT);
    lblRoboyStarmind.setFont(new Font("Ubuntu", Font.BOLD, 30));
    frame.getContentPane().add(lblRoboyStarmind);

    // CONNECTION PANEL
    JPanel connectPanel = new JPanel();
    connectPanel.setBounds(12, 36, 606, 40);
    frame.getContentPane().add(connectPanel);
    connectPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 5));

    JLabel lblAddress = new JLabel("Address:");
    connectPanel.add(lblAddress);

    addressTextField = new JTextField();
    connectPanel.add(addressTextField);
    addressTextField.setColumns(10);

    Component horizontalGlue = Box.createHorizontalGlue();
    connectPanel.add(horizontalGlue);

    JLabel lblPort = new JLabel("Port:");
    connectPanel.add(lblPort);

    portTextField = new JTextField("30000");
    connectPanel.add(portTextField);
    portTextField.setColumns(4);

    Component horizontalGlue_2 = Box.createHorizontalGlue();
    connectPanel.add(horizontalGlue_2);

    JLabel lblIntervalsec = new JLabel("Interval (millis):");
    connectPanel.add(lblIntervalsec);

    delayTextField = new JTextField("500");
    connectPanel.add(delayTextField);
    delayTextField.setColumns(4);

    Component horizontalGlue_1 = Box.createHorizontalGlue();
    connectPanel.add(horizontalGlue_1);

    btnConnect = new JButton("Connect");
    btnConnect.setActionCommand("connect");
    btnConnect.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if ("connect".compareTo(arg0.getActionCommand()) == 0) {
              int p = Integer.parseInt(portTextField.getText());
              int d = Integer.parseInt(delayTextField.getText());
              prefs.put("roboy_address", addressTextField.getText());
              prefs.putInt("roboy_port", p);
              prefs.putInt("roboy_delay", d);
              try {
                prefs.flush();
              } catch (BackingStoreException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              model.connect(addressTextField.getText(), p, d, imagePanel);
            } else {
              model.disconnect();
            }
          }
        });
    connectPanel.add(btnConnect);

    // VIDEO
    imagePanel = new ImagePanel();
    imagePanel.setBounds(12, 85, 606, 349);
    imagePanel.setBackground(Color.BLACK);
    frame.getContentPane().add(imagePanel);

    // TEXT TO SPEECH
    JLabel lblTextToSpeech = new JLabel("Text to Speech");
    lblTextToSpeech.setBounds(12, 446, 266, 24);
    lblTextToSpeech.setHorizontalAlignment(SwingConstants.LEFT);
    lblTextToSpeech.setFont(subTitleFont);
    frame.getContentPane().add(lblTextToSpeech);

    JPanel languagePanel = new JPanel();
    languagePanel.setBounds(12, 510, 322, 38);
    frame.getContentPane().add(languagePanel);
    languagePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 5));

    JLabel lblSpeech = new JLabel("Voice:");
    languagePanel.add(lblSpeech);

    speechComboBox = new JComboBox();
    languagePanel.add(speechComboBox);

    btnSpeech = new JButton("Speak");
    languagePanel.add(btnSpeech);
    btnSpeech.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            sendText();
          }
        });

    textField = new JTextField();
    textField.setBounds(12, 470, 606, 40);
    textField.addKeyListener(
        new KeyListener() {

          @Override
          public void keyTyped(KeyEvent arg0) {
            // TODO Auto-generated method stub
            if (arg0.getKeyChar() == '\n') {
              sendText();
            }
          }

          @Override
          public void keyReleased(KeyEvent arg0) {
            // TODO Auto-generated method stub

          }

          @Override
          public void keyPressed(KeyEvent arg0) {
            // TODO Auto-generated method stub

          }
        });
    frame.getContentPane().add(textField);

    // TABS
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(12, 569, 606, 240);
    frame.getContentPane().add(tabbedPane);

    JPanel modeTabPanel = new JPanel();
    tabbedPane.addTab("Swith Mode", null, modeTabPanel, null);
    modeTabPanel.setLayout(null);

    JLabel lblMode = new JLabel("Mode:");
    lblMode.setBounds(12, 32, 70, 18);
    modeTabPanel.add(lblMode);

    modeTextField = new JTextField();
    modeTextField.setBounds(63, 27, 86, 28);
    modeTabPanel.add(modeTextField);
    modeTextField.setColumns(10);

    btnChangeMode = new JButton("Change Mode");
    btnChangeMode.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            String mode = modeTextField.getText().trim();
            if (!mode.isEmpty()) {
              if (model.sendMode(mode.charAt(0))) {
                modeTextField.setEnabled(false);
                btnChangeMode.setEnabled(false);
              }
            }
          }
        });
    btnChangeMode.setBounds(12, 70, 137, 30);
    modeTabPanel.add(btnChangeMode);

    JPanel headTabpanel = new JPanel();
    tabbedPane.addTab("Head", null, headTabpanel, null);
    headTabpanel.setLayout(null);

    JPanel headPanel = new JPanel();
    headPanel.setBounds(286, 12, 300, 190);
    headTabpanel.add(headPanel);
    GridBagLayout gbl_headPanel = new GridBagLayout();
    gbl_headPanel.columnWidths = new int[] {50, 250, 0};
    gbl_headPanel.rowHeights = new int[] {30, 30, 30, 0};
    gbl_headPanel.columnWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    gbl_headPanel.rowWeights = new double[] {0.0, 0.0, 0.0, Double.MIN_VALUE};
    headPanel.setLayout(gbl_headPanel);

    JLabel lblRoll = new JLabel("Roll:");
    GridBagConstraints gbc_lblRoll = new GridBagConstraints();
    gbc_lblRoll.fill = GridBagConstraints.BOTH;
    gbc_lblRoll.insets = new Insets(0, 0, 5, 5);
    gbc_lblRoll.gridx = 0;
    gbc_lblRoll.gridy = 0;
    headPanel.add(lblRoll, gbc_lblRoll);
    rollSlider = new JSlider();
    rollSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            JSlider slider = (JSlider) e.getSource();
            if (!slider.getValueIsAdjusting()
                && chckbxContinuesSendingHead != null
                && chckbxContinuesSendingHead.isSelected()) {
              model.sendHead(rollSlider.getValue(), pitchSlider.getValue(), yawSlider.getValue());
            }
          }
        });
    rollSlider.setSnapToTicks(true);
    rollSlider.setPaintTicks(true);
    rollSlider.setPaintLabels(true);
    rollSlider.setMinorTickSpacing(1);
    rollSlider.setMajorTickSpacing(1);
    rollSlider.setMinimum(-3);
    rollSlider.setMaximum(3);
    rollSlider.setValue(0);
    GridBagConstraints gbc_rollSlider = new GridBagConstraints();
    gbc_rollSlider.fill = GridBagConstraints.BOTH;
    gbc_rollSlider.insets = new Insets(0, 0, 5, 0);
    gbc_rollSlider.gridx = 1;
    gbc_rollSlider.gridy = 0;
    headPanel.add(rollSlider, gbc_rollSlider);

    JLabel lblPitch = new JLabel("Pitch:");
    GridBagConstraints gbc_lblPitch = new GridBagConstraints();
    gbc_lblPitch.fill = GridBagConstraints.BOTH;
    gbc_lblPitch.insets = new Insets(0, 0, 5, 5);
    gbc_lblPitch.gridx = 0;
    gbc_lblPitch.gridy = 1;
    headPanel.add(lblPitch, gbc_lblPitch);
    pitchSlider = new JSlider();
    pitchSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            JSlider slider = (JSlider) e.getSource();
            if (!slider.getValueIsAdjusting()
                && chckbxContinuesSendingHead != null
                && chckbxContinuesSendingHead.isSelected()) {
              model.sendHead(rollSlider.getValue(), pitchSlider.getValue(), yawSlider.getValue());
            }
          }
        });
    pitchSlider.setMinorTickSpacing(1);
    pitchSlider.setMajorTickSpacing(1);
    pitchSlider.setPaintLabels(true);
    pitchSlider.setPaintTicks(true);
    pitchSlider.setSnapToTicks(true);
    pitchSlider.setMinimum(0);
    pitchSlider.setMaximum(12);
    pitchSlider.setValue(0);
    GridBagConstraints gbc_pitchSlider = new GridBagConstraints();
    gbc_pitchSlider.fill = GridBagConstraints.BOTH;
    gbc_pitchSlider.insets = new Insets(0, 0, 5, 0);
    gbc_pitchSlider.gridx = 1;
    gbc_pitchSlider.gridy = 1;
    headPanel.add(pitchSlider, gbc_pitchSlider);

    JLabel lblYaw = new JLabel("Yaw:");
    GridBagConstraints gbc_lblYaw = new GridBagConstraints();
    gbc_lblYaw.fill = GridBagConstraints.BOTH;
    gbc_lblYaw.insets = new Insets(0, 0, 0, 5);
    gbc_lblYaw.gridx = 0;
    gbc_lblYaw.gridy = 2;
    headPanel.add(lblYaw, gbc_lblYaw);
    yawSlider = new JSlider();
    yawSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            JSlider slider = (JSlider) e.getSource();
            if (!slider.getValueIsAdjusting()
                && chckbxContinuesSendingHead != null
                && chckbxContinuesSendingHead.isSelected()) {
              model.sendHead(rollSlider.getValue(), pitchSlider.getValue(), yawSlider.getValue());
            }
          }
        });
    yawSlider.setMinorTickSpacing(1);
    yawSlider.setMajorTickSpacing(3);
    yawSlider.setSnapToTicks(true);
    yawSlider.setPaintTicks(true);
    yawSlider.setPaintLabels(true);
    yawSlider.setMinimum(-12);
    yawSlider.setMaximum(12);
    yawSlider.setValue(0);
    GridBagConstraints gbc_yawSlider = new GridBagConstraints();
    gbc_yawSlider.fill = GridBagConstraints.BOTH;
    gbc_yawSlider.gridx = 1;
    gbc_yawSlider.gridy = 2;
    headPanel.add(yawSlider, gbc_yawSlider);

    btnResetHeadPosition = new JButton("Reset Head Position");
    btnResetHeadPosition.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            model.sendHead(0, 0, 0);
            resetSliders();
          }
        });
    btnResetHeadPosition.setBounds(12, 26, 231, 30);
    headTabpanel.add(btnResetHeadPosition);

    btnSendHeadPosition = new JButton("Send Head Position");
    btnSendHeadPosition.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            model.sendHead(rollSlider.getValue(), pitchSlider.getValue(), yawSlider.getValue());
          }
        });
    btnSendHeadPosition.setBounds(12, 106, 231, 30);
    headTabpanel.add(btnSendHeadPosition);

    chckbxContinuesSendingHead = new JCheckBox("Continues sending head position");
    chckbxContinuesSendingHead.setBounds(12, 70, 262, 24);
    headTabpanel.add(chckbxContinuesSendingHead);

    JPanel facialTabPanel = new JPanel();
    tabbedPane.addTab("Facial", null, facialTabPanel, null);
    facialTabPanel.setLayout(null);

    JLabel lblExpression = new JLabel("Expression:");
    lblExpression.setBounds(12, 32, 103, 18);
    facialTabPanel.add(lblExpression);

    expressionComboBox = new JComboBox();
    expressionComboBox.setBounds(104, 27, 250, 28);
    facialTabPanel.add(expressionComboBox);

    btnRunFacialExpression = new JButton("Run Facial Expression");
    btnRunFacialExpression.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            String facial = expressionComboBox.getSelectedItem().toString();
            if (!facial.isEmpty()) {
              model.sendFacial(facial);
            }
          }
        });
    btnRunFacialExpression.setBounds(12, 70, 245, 30);
    facialTabPanel.add(btnRunFacialExpression);

    JPanel bodyTabPanel = new JPanel();
    tabbedPane.addTab("Body", null, bodyTabPanel, null);
    bodyTabPanel.setLayout(null);

    JLabel lblMovement = new JLabel("Movement:");
    lblMovement.setBounds(12, 32, 102, 18);
    bodyTabPanel.add(lblMovement);

    movementComboBox = new JComboBox();
    movementComboBox.setBounds(104, 27, 250, 28);
    bodyTabPanel.add(movementComboBox);

    btnRunBodyMovement = new JButton("Run Body Movement");
    btnRunBodyMovement.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String body = movementComboBox.getSelectedItem().toString();
            if (!body.isEmpty()) {
              model.sendBody(body);
            }
          }
        });
    btnRunBodyMovement.setBounds(12, 70, 245, 30);
    bodyTabPanel.add(btnRunBodyMovement);
  }
コード例 #26
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);
  }
コード例 #27
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmTheLittleEngine = new JFrame();
    frmTheLittleEngine.setTitle("The Little Engine That Code");
    frmTheLittleEngine.setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage(
                "C:\\Users\\Jeff\\Documents\\College\\Senior Year\\COE 1186\\System\\train_pic.png"));
    frmTheLittleEngine.setBounds(100, 100, 878, 561);
    frmTheLittleEngine.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmTheLittleEngine.getContentPane().setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT);
    tabbedPane.setBorder(new LineBorder(new Color(0, 0, 0)));
    tabbedPane.setBounds(10, 11, 842, 501);
    frmTheLittleEngine.getContentPane().add(tabbedPane);

    JPanel ctcTab = new JPanel();
    tabbedPane.addTab("CTC", null, ctcTab, null);
    ctcTab.setLayout(null);

    JPanel panel_4 = new JPanel();
    panel_4.setBounds(0, 0, 743, 494);
    ctcTab.add(panel_4);
    panel_4.setLayout(null);

    JLabel lblNewLabel_1 = new JLabel("Schedule");
    lblNewLabel_1.setBounds(120, 11, 69, 14);
    panel_4.add(lblNewLabel_1);

    JRadioButton rdbtnNewRadioButton = new JRadioButton("Fixed Block");
    rdbtnNewRadioButton.setBounds(6, 32, 98, 23);
    panel_4.add(rdbtnNewRadioButton);

    JRadioButton rdbtnMbo = new JRadioButton("MBO");
    rdbtnMbo.setBounds(104, 32, 52, 23);
    panel_4.add(rdbtnMbo);

    JButton btnRequestSchedule = new JButton("Request Schedule");
    btnRequestSchedule.setBounds(175, 32, 139, 23);
    panel_4.add(btnRequestSchedule);

    JLabel lblNewLabel_2 = new JLabel("Train");
    lblNewLabel_2.setBounds(49, 62, 46, 14);
    panel_4.add(lblNewLabel_2);

    JLabel lblNewLabel_3 = new JLabel("Line");
    lblNewLabel_3.setBounds(160, 62, 46, 14);
    panel_4.add(lblNewLabel_3);

    JLabel lblNewLabel_4 = new JLabel("Stations");
    lblNewLabel_4.setBounds(254, 62, 60, 14);
    panel_4.add(lblNewLabel_4);

    JButton btnLoadStations = new JButton("Load Stations");
    btnLoadStations.setBounds(6, 106, 116, 23);
    panel_4.add(btnLoadStations);

    JButton btnSchedule = new JButton("Schedule");
    btnSchedule.setBounds(130, 106, 105, 23);
    panel_4.add(btnSchedule);

    JButton btnRoute = new JButton("Route");
    btnRoute.setBounds(245, 106, 69, 23);
    panel_4.add(btnRoute);

    trainID = new JTextField();
    trainID.setBounds(33, 76, 60, 23);
    panel_4.add(trainID);
    trainID.setColumns(10);

    JComboBox comboLine = new JComboBox();
    comboLine.setBounds(130, 76, 89, 23);
    panel_4.add(comboLine);

    JScrollPane scrollPane_3 = new JScrollPane();
    scrollPane_3.setBounds(6, 140, 308, 325);
    panel_4.add(scrollPane_3);

    table = new JTable();
    scrollPane_3.setViewportView(table);
    table.setModel(
        new DefaultTableModel(
            new Object[][] {
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
              {null, null, null},
            },
            new String[] {"Train", "Line", "Destination"}));
    table.setBorder(new LineBorder(new Color(0, 0, 0)));

    JLabel lblNewLabel_5 = new JLabel("Clock:");
    lblNewLabel_5.setBounds(390, 11, 46, 14);
    panel_4.add(lblNewLabel_5);

    textTime = new JTextField();
    textTime.setBounds(431, 8, 151, 20);
    panel_4.add(textTime);
    textTime.setColumns(10);

    JButton btnGetTime = new JButton("Get Time");
    btnGetTime.setBounds(592, 7, 89, 23);
    panel_4.add(btnGetTime);

    JLabel lblMessagesToTrack = new JLabel("Messages To Track Controller");
    lblMessagesToTrack.setFont(new Font("Tahoma", Font.PLAIN, 13));
    lblMessagesToTrack.setBounds(453, 61, 228, 14);
    panel_4.add(lblMessagesToTrack);

    JLabel lblRouting = new JLabel("Routing");
    lblRouting.setBounds(515, 80, 60, 14);
    panel_4.add(lblRouting);

    JLabel lblOpencloseTrack = new JLabel("Open/Close Track");
    lblOpencloseTrack.setBounds(380, 283, 139, 14);
    panel_4.add(lblOpencloseTrack);

    JLabel lblBlockStatus = new JLabel("Block Status");
    lblBlockStatus.setBounds(600, 283, 116, 14);
    panel_4.add(lblBlockStatus);

    JButton btnShowBeacon = new JButton("Show Beacon");
    btnShowBeacon.setBounds(380, 245, 116, 23);
    panel_4.add(btnShowBeacon);

    JButton btnDispatch = new JButton("Dispatch");
    btnDispatch.setBounds(590, 245, 98, 23);
    panel_4.add(btnDispatch);

    JLabel lblBlock = new JLabel("Block");
    lblBlock.setBounds(336, 308, 52, 14);
    panel_4.add(lblBlock);

    JLabel lblLine = new JLabel("Line");
    lblLine.setBounds(431, 308, 46, 14);
    panel_4.add(lblLine);

    JLabel label_42 = new JLabel("Block");
    label_42.setBounds(530, 308, 52, 14);
    panel_4.add(label_42);

    JLabel label_56 = new JLabel("Line");
    label_56.setBounds(627, 308, 46, 14);
    panel_4.add(label_56);

    textField_8 = new JTextField();
    textField_8.setColumns(10);
    textField_8.setBounds(375, 304, 46, 23);
    panel_4.add(textField_8);

    textField_9 = new JTextField();
    textField_9.setColumns(10);
    textField_9.setBounds(459, 304, 60, 23);
    panel_4.add(textField_9);

    textField_10 = new JTextField();
    textField_10.setColumns(10);
    textField_10.setBounds(572, 304, 45, 23);
    panel_4.add(textField_10);

    textField_11 = new JTextField();
    textField_11.setColumns(10);
    textField_11.setBounds(658, 304, 60, 23);
    panel_4.add(textField_11);

    JButton btnOpen = new JButton("Open");
    btnOpen.setBounds(336, 442, 76, 23);
    panel_4.add(btnOpen);

    JButton btnClose = new JButton("Close");
    btnClose.setBounds(443, 442, 76, 23);
    panel_4.add(btnClose);

    JButton btnGetStatus = new JButton("Get Status");
    btnGetStatus.setBounds(572, 442, 105, 23);
    panel_4.add(btnGetStatus);

    JTextArea txtrOpencloseMessages = new JTextArea();
    txtrOpencloseMessages.setText("Open/Close Messages:");
    txtrOpencloseMessages.setBounds(336, 333, 183, 98);
    txtrOpencloseMessages.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_4.add(txtrOpencloseMessages);

    JTextArea textArea_1 = new JTextArea();
    textArea_1.setBounds(533, 333, 183, 98);
    textArea_1.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_4.add(textArea_1);

    JTextArea txtrProceedMessages = new JTextArea();
    txtrProceedMessages.setText("Proceed Messages:");
    txtrProceedMessages.setBounds(380, 106, 308, 134);
    txtrProceedMessages.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_4.add(txtrProceedMessages);

    JPanel trackControllerTab = new JPanel();
    tabbedPane.addTab("Track Controller", null, trackControllerTab, null);
    trackControllerTab.setLayout(null);

    JPanel trackControllerPanel = new JPanel();
    trackControllerPanel.setBorder(null);
    trackControllerPanel.setBounds(10, 40, 711, 443);
    trackControllerTab.add(trackControllerPanel);
    trackControllerPanel.setLayout(null);

    JLabel label_2 = new JLabel("Track Controller ID");
    label_2.setBounds(240, 11, 129, 14);
    trackControllerPanel.add(label_2);

    JComboBox<Integer> tcComboBox = new JComboBox<Integer>();
    tcComboBox.setBounds(349, 8, 81, 20);
    trackControllerPanel.add(tcComboBox);

    JLabel label_3 = new JLabel("PLC Program");
    label_3.setBounds(10, 55, 109, 14);
    trackControllerPanel.add(label_3);

    plcProgramPathTextbox = new JTextField();
    plcProgramPathTextbox.setText("C:/");
    plcProgramPathTextbox.setEditable(false);
    plcProgramPathTextbox.setColumns(10);
    plcProgramPathTextbox.setBounds(93, 52, 375, 20);
    trackControllerPanel.add(plcProgramPathTextbox);

    JButton button = new JButton("Browse");
    button.setBounds(478, 51, 89, 23);
    trackControllerPanel.add(button);

    JButton button_1 = new JButton("Load");
    button_1.setEnabled(false);
    button_1.setBounds(590, 51, 89, 23);
    trackControllerPanel.add(button_1);

    JLabel label_4 = new JLabel("Blocks");
    label_4.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_4.setBounds(10, 102, 46, 14);
    trackControllerPanel.add(label_4);

    JLabel label_5 =
        new JLabel("Section      Number       Occupied      Broken      Maintanence   ");
    label_5.setBounds(10, 127, 340, 14);
    trackControllerPanel.add(label_5);

    JLabel label_6 = new JLabel("Railways");
    label_6.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_6.setBounds(397, 102, 146, 14);
    trackControllerPanel.add(label_6);

    JLabel label_7 = new JLabel("Block              Status");
    label_7.setBounds(397, 127, 170, 14);
    trackControllerPanel.add(label_7);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 152, 359, 242);
    trackControllerPanel.add(scrollPane);

    JList<String> blocksListBox = new JList<String>();
    scrollPane.setViewportView(blocksListBox);
    blocksListBox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    blocksListBox.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));

    JButton breakBlockButton = new JButton("Break");
    breakBlockButton.setEnabled(false);
    breakBlockButton.setBounds(84, 405, 89, 27);
    trackControllerPanel.add(breakBlockButton);

    JButton maintBlockButton = new JButton("Maintanence");
    maintBlockButton.setEnabled(false);
    maintBlockButton.setBounds(183, 405, 109, 27);
    trackControllerPanel.add(maintBlockButton);

    JLabel label_8 = new JLabel("Switches");
    label_8.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_8.setBounds(397, 266, 146, 14);
    trackControllerPanel.add(label_8);

    JLabel label_9 = new JLabel("Block      Switch    Status");
    label_9.setBounds(397, 291, 160, 14);
    trackControllerPanel.add(label_9);

    JButton button_2 = new JButton("Activate Crossing");
    button_2.setEnabled(false);
    button_2.setBounds(456, 233, 160, 27);
    trackControllerPanel.add(button_2);

    JButton button_3 = new JButton("Switch Track");
    button_3.setEnabled(false);
    button_3.setBounds(489, 405, 109, 27);
    trackControllerPanel.add(button_3);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(396, 152, 306, 70);
    trackControllerPanel.add(scrollPane_1);

    JList<String> railwayListbox = new JList<String>();
    railwayListbox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    railwayListbox.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    scrollPane_1.setViewportView(railwayListbox);

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(396, 316, 306, 78);
    trackControllerPanel.add(scrollPane_2);

    JList<String> switchListbox = new JList<String>();
    switchListbox.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    switchListbox.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    scrollPane_2.setViewportView(switchListbox);

    JLabel label = new JLabel("Red Line");
    label.setFont(new Font("Tahoma", Font.PLAIN, 16));
    label.setBounds(252, 11, 101, 23);
    trackControllerTab.add(label);

    JSlider changeViewSlider = new JSlider();
    changeViewSlider.setValue(1);
    changeViewSlider.setMaximum(1);
    changeViewSlider.setBounds(325, 11, 28, 23);
    trackControllerTab.add(changeViewSlider);

    JLabel label_1 = new JLabel("Green Line");
    label_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
    label_1.setBounds(363, 11, 134, 23);
    trackControllerTab.add(label_1);

    JPanel TrainModelTab = new JPanel();
    tabbedPane.addTab("Track Model", null, TrainModelTab, null);

    JPanel trainControllerTab = new JPanel();
    tabbedPane.addTab("Train Controller", null, trainControllerTab, null);
    trainControllerTab.setLayout(null);

    JPanel panel_1 = new JPanel();
    panel_1.setLayout(null);
    panel_1.setBounds(10, 48, 723, 341);
    trainControllerTab.add(panel_1);

    JSlider slider = new JSlider();
    slider.setSnapToTicks(true);
    slider.setPaintTicks(true);
    slider.setPaintLabels(true);
    slider.setOrientation(SwingConstants.VERTICAL);
    slider.setMinorTickSpacing(1);
    slider.setMaximum(70);
    slider.setMajorTickSpacing(10);
    slider.setBounds(0, 108, 81, 211);
    panel_1.add(slider);

    JToggleButton toggleButton = new JToggleButton("Toggle AutoPilot");
    toggleButton.setForeground(Color.BLUE);
    toggleButton.setBounds(201, 29, 290, 29);
    panel_1.add(toggleButton);

    JLabel label_36 = new JLabel("Desired");
    label_36.setHorizontalAlignment(SwingConstants.CENTER);
    label_36.setFont(new Font("Modern No. 20", Font.BOLD, 20));
    label_36.setBounds(0, 54, 81, 29);
    panel_1.add(label_36);

    JLabel label_37 = new JLabel("Current Speed");
    label_37.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_37.setBounds(245, 114, 88, 16);
    panel_1.add(label_37);

    JLabel label_38 = new JLabel("Current Speed Limit");
    label_38.setHorizontalAlignment(SwingConstants.RIGHT);
    label_38.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_38.setBounds(192, 189, 142, 16);
    panel_1.add(label_38);

    JLabel label_39 = new JLabel("Current Authority");
    label_39.setHorizontalAlignment(SwingConstants.RIGHT);
    label_39.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_39.setBounds(202, 224, 133, 16);
    panel_1.add(label_39);

    JLabel label_40 = new JLabel("ERRORS");
    label_40.setHorizontalAlignment(SwingConstants.RIGHT);
    label_40.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_40.setBounds(201, 303, 132, 16);
    panel_1.add(label_40);

    JLabel label_41 = new JLabel("Beacon Message");
    label_41.setHorizontalAlignment(SwingConstants.RIGHT);
    label_41.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_41.setBounds(192, 259, 132, 16);
    panel_1.add(label_41);

    JLabel label_43 = new JLabel("NEXT STATION");
    label_43.setHorizontalAlignment(SwingConstants.CENTER);
    label_43.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_43.setBounds(525, 13, 198, 16);
    panel_1.add(label_43);

    JToggleButton toggle_service = new JToggleButton("SERVICE BRAKE");
    toggle_service.setForeground(Color.GREEN);
    toggle_service.setBackground(Color.BLACK);
    toggle_service.setBounds(541, 77, 162, 80);
    panel_1.add(toggle_service);

    JLabel label_44 = new JLabel("16");
    label_44.setBackground(Color.BLACK);
    label_44.setBounds(584, -14, 25, 16);
    panel_1.add(label_44);

    JToggleButton toggle_emergency = new JToggleButton("EMERGENCY BRAKE");
    toggle_emergency.setForeground(Color.RED);
    toggle_emergency.setBackground(Color.BLACK);
    toggle_emergency.setBounds(541, 166, 162, 80);
    panel_1.add(toggle_emergency);

    JSlider slider_1 = new JSlider();
    slider_1.setSnapToTicks(true);
    slider_1.setPaintTicks(true);
    slider_1.setPaintLabels(true);
    slider_1.setOrientation(SwingConstants.VERTICAL);
    slider_1.setMinorTickSpacing(1);
    slider_1.setMaximum(70);
    slider_1.setMajorTickSpacing(10);
    slider_1.setEnabled(false);
    slider_1.setBounds(91, 108, 81, 211);
    panel_1.add(slider_1);

    JLabel label_45 = new JLabel("Speed");
    label_45.setHorizontalAlignment(SwingConstants.CENTER);
    label_45.setFont(new Font("Modern No. 20", Font.BOLD, 20));
    label_45.setBounds(91, 77, 71, 35);
    panel_1.add(label_45);

    JLabel label_46 = new JLabel("Commanded Power");
    label_46.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_46.setBounds(212, 81, 121, 16);
    panel_1.add(label_46);

    JLabel label_47 = new JLabel("Speed");
    label_47.setHorizontalAlignment(SwingConstants.CENTER);
    label_47.setFont(new Font("Modern No. 20", Font.BOLD, 20));
    label_47.setBounds(0, 77, 81, 29);
    panel_1.add(label_47);

    JLabel label_48 = new JLabel("Acutal");
    label_48.setHorizontalAlignment(SwingConstants.CENTER);
    label_48.setFont(new Font("Modern No. 20", Font.BOLD, 20));
    label_48.setBounds(93, 54, 65, 29);
    panel_1.add(label_48);

    JLabel label_49 = new JLabel("Desired Speed");
    label_49.setHorizontalAlignment(SwingConstants.RIGHT);
    label_49.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_49.setBounds(191, 153, 142, 16);
    panel_1.add(label_49);

    textField = new JTextField();
    textField.setEditable(false);
    textField.setColumns(10);
    textField.setBounds(346, 71, 185, 28);
    panel_1.add(textField);

    textField_1 = new JTextField();
    textField_1.setEditable(false);
    textField_1.setColumns(10);
    textField_1.setBounds(346, 107, 185, 28);
    panel_1.add(textField_1);

    textField_2 = new JTextField();
    textField_2.setEditable(false);
    textField_2.setColumns(10);
    textField_2.setBounds(346, 146, 185, 28);
    panel_1.add(textField_2);

    textField_3 = new JTextField();
    textField_3.setEditable(false);
    textField_3.setColumns(10);
    textField_3.setBounds(346, 182, 185, 28);
    panel_1.add(textField_3);

    textField_4 = new JTextField();
    textField_4.setEditable(false);
    textField_4.setColumns(10);
    textField_4.setBounds(346, 218, 185, 28);
    panel_1.add(textField_4);

    textField_5 = new JTextField();
    textField_5.setEditable(false);
    textField_5.setColumns(10);
    textField_5.setBounds(346, 252, 185, 28);
    panel_1.add(textField_5);

    textField_6 = new JTextField();
    textField_6.setEditable(false);
    textField_6.setColumns(10);
    textField_6.setBounds(344, 291, 187, 28);
    panel_1.add(textField_6);

    textField_7 = new JTextField();
    textField_7.setEditable(false);
    textField_7.setColumns(10);
    textField_7.setBounds(542, 33, 162, 28);
    panel_1.add(textField_7);

    JLabel label_50 = new JLabel("Manual Mode in ON");
    label_50.setHorizontalAlignment(SwingConstants.CENTER);
    label_50.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_50.setBounds(265, 11, 162, 16);
    panel_1.add(label_50);

    JLabel label_51 = new JLabel("");
    label_51.setHorizontalAlignment(SwingConstants.CENTER);
    label_51.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_51.setBounds(524, 317, 247, 16);
    panel_1.add(label_51);

    JPanel panel_2 = new JPanel();
    panel_2.setLayout(null);
    panel_2.setBounds(10, 400, 723, 83);
    trainControllerTab.add(panel_2);

    JLabel label_35 = new JLabel("Arriving At Station");
    label_35.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_35.setBounds(18, 11, 129, 16);
    panel_2.add(label_35);

    JLabel label_52 = new JLabel("Lights On");
    label_52.setHorizontalAlignment(SwingConstants.CENTER);
    label_52.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_52.setBounds(127, 11, 129, 16);
    panel_2.add(label_52);

    JLabel label_53 = new JLabel("Doors Open");
    label_53.setHorizontalAlignment(SwingConstants.CENTER);
    label_53.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_53.setBounds(243, 11, 107, 16);
    panel_2.add(label_53);

    JLabel label_54 = new JLabel("Announcement in Progress");
    label_54.setHorizontalAlignment(SwingConstants.CENTER);
    label_54.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_54.setBounds(358, 11, 180, 16);
    panel_2.add(label_54);

    JLabel label_55 = new JLabel("Thermostat");
    label_55.setHorizontalAlignment(SwingConstants.CENTER);
    label_55.setFont(new Font("Modern No. 20", Font.PLAIN, 15));
    label_55.setBounds(577, 11, 107, 16);
    panel_2.add(label_55);

    JSlider slider_thermo = new JSlider();
    slider_thermo.setSnapToTicks(true);
    slider_thermo.setPaintTicks(true);
    slider_thermo.setPaintLabels(true);
    slider_thermo.setMaximum(80);
    slider_thermo.setMajorTickSpacing(15);
    slider_thermo.setBounds(559, 28, 144, 49);
    panel_2.add(slider_thermo);

    JRadioButton radioButton_announcement = new JRadioButton("");
    radioButton_announcement.setHorizontalAlignment(SwingConstants.CENTER);
    radioButton_announcement.setBounds(368, 39, 141, 23);
    panel_2.add(radioButton_announcement);

    JRadioButton radioButton_doors = new JRadioButton("");
    radioButton_doors.setHorizontalAlignment(SwingConstants.CENTER);
    radioButton_doors.setBounds(223, 39, 141, 23);
    panel_2.add(radioButton_doors);

    JRadioButton radioButton_lights = new JRadioButton("");
    radioButton_lights.setHorizontalAlignment(SwingConstants.CENTER);
    radioButton_lights.setBounds(115, 39, 141, 23);
    panel_2.add(radioButton_lights);

    JRadioButton radioButton_station = new JRadioButton("");
    radioButton_station.setHorizontalAlignment(SwingConstants.CENTER);
    radioButton_station.setBounds(6, 39, 141, 23);
    panel_2.add(radioButton_station);

    JPanel panel_3 = new JPanel();
    panel_3.setBounds(194, 11, 319, 37);
    trainControllerTab.add(panel_3);
    panel_3.setLayout(null);

    JLabel lblNewLabel = new JLabel("Train Controller ID");
    lblNewLabel.setBounds(40, 11, 134, 14);
    panel_3.add(lblNewLabel);

    JComboBox trainControllerIdComboBox = new JComboBox();
    trainControllerIdComboBox.setBounds(165, 8, 69, 20);
    panel_3.add(trainControllerIdComboBox);

    JPanel trainModelTab = new JPanel();
    tabbedPane.addTab("Train Model", null, trainModelTab, null);
    trainModelTab.setLayout(null);

    JPanel panel = new JPanel();
    panel.setBounds(10, 11, 723, 472);
    trainModelTab.add(panel);
    panel.setLayout(null);

    JComboBox trainModelComboBox = new JComboBox();
    trainModelComboBox.setBounds(338, 11, 47, 20);
    panel.add(trainModelComboBox);

    JLabel trainIdLabel = new JLabel("Train ID");
    trainIdLabel.setBounds(269, 14, 46, 14);
    panel.add(trainIdLabel);

    JLabel label_10 = new JLabel("Information");
    label_10.setBounds(64, 66, 66, 16);
    panel.add(label_10);

    JLabel label_11 = new JLabel("ID #");
    label_11.setBounds(10, 111, 31, 16);
    panel.add(label_11);

    JLabel label_12 = new JLabel("Length:");
    label_12.setBounds(10, 141, 43, 16);
    panel.add(label_12);

    JLabel label_13 = new JLabel("Width:");
    label_13.setBounds(10, 174, 38, 16);
    panel.add(label_13);

    JLabel label_14 = new JLabel("Height:");
    label_14.setBounds(10, 207, 41, 16);
    panel.add(label_14);

    JLabel label_15 = new JLabel("Mass:");
    label_15.setBounds(10, 240, 34, 16);
    panel.add(label_15);

    JLabel label_16 = new JLabel("Cars:");
    label_16.setBounds(10, 273, 31, 16);
    panel.add(label_16);

    JLabel label_17 = new JLabel("Crew Count:");
    label_17.setBounds(10, 303, 72, 16);
    panel.add(label_17);

    JLabel label_18 = new JLabel("Passenger Count:");
    label_18.setBounds(10, 333, 101, 16);
    panel.add(label_18);

    JLabel label_19 = new JLabel("Stop:");
    label_19.setBounds(10, 366, 38, 16);
    panel.add(label_19);

    JLabel label_20 = new JLabel("Distance:");
    label_20.setBounds(10, 396, 56, 16);
    panel.add(label_20);

    JLabel label_21 = new JLabel("Grade:");
    label_21.setBounds(10, 429, 39, 16);
    panel.add(label_21);

    JLabel label_22 = new JLabel("Inputs");
    label_22.setBounds(317, 66, 35, 16);
    panel.add(label_22);

    JLabel label_23 = new JLabel("Outputs");
    label_23.setBounds(587, 66, 51, 16);
    panel.add(label_23);

    txtID = new JTextField();
    txtID.setHorizontalAlignment(SwingConstants.RIGHT);
    txtID.setEditable(false);
    txtID.setColumns(10);
    txtID.setBounds(63, 108, 112, 22);
    panel.add(txtID);

    txtLength = new JTextField();
    txtLength.setText("105.643 ft");
    txtLength.setHorizontalAlignment(SwingConstants.RIGHT);
    txtLength.setEditable(false);
    txtLength.setColumns(10);
    txtLength.setBounds(63, 138, 112, 22);
    panel.add(txtLength);

    txtWidth = new JTextField();
    txtWidth.setText("8.694 ft");
    txtWidth.setHorizontalAlignment(SwingConstants.RIGHT);
    txtWidth.setEditable(false);
    txtWidth.setColumns(10);
    txtWidth.setBounds(55, 171, 120, 22);
    panel.add(txtWidth);

    txtHeight = new JTextField();
    txtHeight.setText("11.221 ft");
    txtHeight.setHorizontalAlignment(SwingConstants.RIGHT);
    txtHeight.setEditable(false);
    txtHeight.setColumns(10);
    txtHeight.setBounds(55, 204, 120, 22);
    panel.add(txtHeight);

    txtMass = new JTextField();
    txtMass.setText("80200 lbs");
    txtMass.setHorizontalAlignment(SwingConstants.RIGHT);
    txtMass.setEditable(false);
    txtMass.setColumns(10);
    txtMass.setBounds(55, 237, 120, 22);
    panel.add(txtMass);

    txtCars = new JTextField();
    txtCars.setText("1");
    txtCars.setHorizontalAlignment(SwingConstants.RIGHT);
    txtCars.setEditable(false);
    txtCars.setColumns(10);
    txtCars.setBounds(64, 270, 111, 22);
    panel.add(txtCars);

    txtCrewCount = new JTextField();
    txtCrewCount.setText("2");
    txtCrewCount.setHorizontalAlignment(SwingConstants.RIGHT);
    txtCrewCount.setEditable(false);
    txtCrewCount.setColumns(10);
    txtCrewCount.setBounds(90, 300, 85, 22);
    panel.add(txtCrewCount);

    txtPassengerCount = new JTextField();
    txtPassengerCount.setText("0");
    txtPassengerCount.setHorizontalAlignment(SwingConstants.RIGHT);
    txtPassengerCount.setEditable(false);
    txtPassengerCount.setColumns(10);
    txtPassengerCount.setBounds(119, 330, 56, 22);
    panel.add(txtPassengerCount);

    txtRoute = new JTextField();
    txtRoute.setHorizontalAlignment(SwingConstants.RIGHT);
    txtRoute.setEditable(false);
    txtRoute.setColumns(10);
    txtRoute.setBounds(48, 363, 127, 22);
    panel.add(txtRoute);

    txtDistance = new JTextField();
    txtDistance.setHorizontalAlignment(SwingConstants.RIGHT);
    txtDistance.setEditable(false);
    txtDistance.setColumns(10);
    txtDistance.setBounds(76, 393, 99, 22);
    panel.add(txtDistance);

    txtGrade = new JTextField();
    txtGrade.setText("0");
    txtGrade.setHorizontalAlignment(SwingConstants.RIGHT);
    txtGrade.setEditable(false);
    txtGrade.setColumns(10);
    txtGrade.setBounds(55, 426, 120, 22);
    panel.add(txtGrade);

    JLabel label_24 = new JLabel("Authority:");
    label_24.setBounds(218, 111, 56, 16);
    panel.add(label_24);

    txtAuthority = new JTextField();
    txtAuthority.setText("0");
    txtAuthority.setHorizontalAlignment(SwingConstants.RIGHT);
    txtAuthority.setEditable(false);
    txtAuthority.setColumns(10);
    txtAuthority.setBounds(283, 108, 160, 22);
    panel.add(txtAuthority);

    txtPower = new JTextField();
    txtPower.setText("0");
    txtPower.setHorizontalAlignment(SwingConstants.RIGHT);
    txtPower.setEditable(false);
    txtPower.setColumns(10);
    txtPower.setBounds(283, 138, 160, 22);
    panel.add(txtPower);

    JLabel label_25 = new JLabel("Power:");
    label_25.setBounds(218, 141, 41, 16);
    panel.add(label_25);

    JLabel label_26 = new JLabel("Commanded Speed:");
    label_26.setBounds(218, 174, 121, 16);
    panel.add(label_26);

    txtSpeedLimit = new JTextField();
    txtSpeedLimit.setText("43.496");
    txtSpeedLimit.setHorizontalAlignment(SwingConstants.RIGHT);
    txtSpeedLimit.setEditable(false);
    txtSpeedLimit.setColumns(10);
    txtSpeedLimit.setBounds(338, 171, 105, 22);
    panel.add(txtSpeedLimit);

    txtTempIn = new JTextField();
    txtTempIn.setText("69");
    txtTempIn.setHorizontalAlignment(SwingConstants.RIGHT);
    txtTempIn.setEditable(false);
    txtTempIn.setColumns(10);
    txtTempIn.setBounds(300, 204, 143, 22);
    panel.add(txtTempIn);

    JLabel label_27 = new JLabel("Temperature:");
    label_27.setBounds(218, 207, 80, 16);
    panel.add(label_27);

    JLabel label_28 = new JLabel("Failures");
    label_28.setBounds(398, 288, 45, 16);
    panel.add(label_28);

    JToggleButton tglbtnEngineFailure = new JToggleButton("Engine Failure");
    tglbtnEngineFailure.setBounds(218, 320, 113, 29);
    panel.add(tglbtnEngineFailure);

    JToggleButton tglbtnSignalPickupFailure = new JToggleButton("Signal Pickup Failure");
    tglbtnSignalPickupFailure.setBounds(338, 318, 160, 31);
    panel.add(tglbtnSignalPickupFailure);

    JToggleButton tglbtnBrakeFailure = new JToggleButton("Brake Failure");
    tglbtnBrakeFailure.setBounds(508, 320, 116, 29);
    panel.add(tglbtnBrakeFailure);

    JLabel label_29 = new JLabel("Mode");
    label_29.setBounds(398, 366, 45, 16);
    panel.add(label_29);

    JRadioButton rdbtnAutomatic = new JRadioButton("Automatic");
    rdbtnAutomatic.setBounds(325, 392, 85, 25);
    panel.add(rdbtnAutomatic);

    JRadioButton rdbtnManual = new JRadioButton("Manual");
    rdbtnManual.setSelected(true);
    rdbtnManual.setBounds(440, 392, 69, 25);
    panel.add(rdbtnManual);

    txtSpeed = new JTextField();
    txtSpeed.setHorizontalAlignment(SwingConstants.RIGHT);
    txtSpeed.setEditable(false);
    txtSpeed.setColumns(10);
    txtSpeed.setBounds(582, 108, 113, 22);
    panel.add(txtSpeed);

    txtAcceleration = new JTextField();
    txtAcceleration.setHorizontalAlignment(SwingConstants.RIGHT);
    txtAcceleration.setEditable(false);
    txtAcceleration.setColumns(10);
    txtAcceleration.setBounds(582, 138, 113, 22);
    panel.add(txtAcceleration);

    txtTemp = new JTextField();
    txtTemp.setText("69");
    txtTemp.setHorizontalAlignment(SwingConstants.RIGHT);
    txtTemp.setEditable(false);
    txtTemp.setColumns(10);
    txtTemp.setBounds(582, 171, 113, 22);
    panel.add(txtTemp);

    txtDoors = new JTextField();
    txtDoors.setHorizontalAlignment(SwingConstants.RIGHT);
    txtDoors.setEditable(false);
    txtDoors.setColumns(10);
    txtDoors.setBounds(542, 204, 153, 22);
    panel.add(txtDoors);

    txtLights = new JTextField();
    txtLights.setHorizontalAlignment(SwingConstants.RIGHT);
    txtLights.setEditable(false);
    txtLights.setColumns(10);
    txtLights.setBounds(542, 237, 153, 22);
    panel.add(txtLights);

    JLabel label_30 = new JLabel("Lights:");
    label_30.setBounds(494, 240, 38, 16);
    panel.add(label_30);

    JLabel label_31 = new JLabel("Doors:");
    label_31.setBounds(494, 207, 38, 16);
    panel.add(label_31);

    JLabel label_32 = new JLabel("Temperature:");
    label_32.setBounds(494, 174, 80, 16);
    panel.add(label_32);

    JLabel label_33 = new JLabel("Acceleration:");
    label_33.setBounds(494, 141, 75, 16);
    panel.add(label_33);

    JLabel label_34 = new JLabel("Actual Speed:");
    label_34.setBounds(494, 111, 80, 16);
    panel.add(label_34);

    JPanel mboTab = new JPanel();
    tabbedPane.addTab("MBO", null, mboTab, null);
    mboTab.setLayout(null);

    JPanel panel_5 = new JPanel();
    panel_5.setBounds(0, 0, 743, 494);
    mboTab.add(panel_5);
    panel_5.setLayout(null);

    JScrollPane scrollPane_4 = new JScrollPane();
    scrollPane_4.setBounds(0, 100, 733, 193);
    panel_5.add(scrollPane_4);

    scheduleJTable = new JTable();
    scheduleJTable.setModel(
        new DefaultTableModel(
            new Object[][] {
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
              {null, null, null, null},
            },
            new String[] {"Train ID", "Line", "Station", "Total Time to Station (min)"}));
    scrollPane_4.setViewportView(scheduleJTable);

    JScrollPane scrollPane_5 = new JScrollPane();
    scrollPane_5.setBounds(0, 304, 733, 179);
    panel_5.add(scrollPane_5);

    operatorScheduleJTable = new JTable();
    operatorScheduleJTable.setModel(
        new DefaultTableModel(
            new Object[][] {
              {null, null, null, null, null, null},
              {null, null, null, null, null, null},
              {null, null, null, null, null, null},
              {null, null, null, null, null, null},
              {null, null, null, null, null, null},
              {null, null, null, null, null, null},
              {null, null, null, null, null, null},
              {null, null, null, null, null, null},
              {null, null, null, null, null, null},
            },
            new String[] {
              "Operator", "Train ID", "Shift Start", "Break Start", "Break End", "Shift End"
            }));
    scrollPane_5.setViewportView(operatorScheduleJTable);

    JPanel panel_6 = new JPanel();
    panel_6.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_6.setBounds(175, 11, 347, 84);
    panel_5.add(panel_6);
    panel_6.setLayout(null);

    JButton trainScheduleButton = new JButton("Set Train Schedule");
    trainScheduleButton.setEnabled(true);
    trainScheduleButton.setBounds(10, 2, 152, 23);
    panel_6.add(trainScheduleButton);

    JButton operatorScheduleButton = new JButton("Set Operator Schedule");
    operatorScheduleButton.setEnabled(true);
    operatorScheduleButton.setBounds(164, 2, 173, 23);
    panel_6.add(operatorScheduleButton);

    JLabel startLabel = new JLabel("Start Schedule at Time:");
    startLabel.setBounds(48, 39, 158, 14);
    panel_6.add(startLabel);

    startInput = new JTextField("00:00", 4);
    startInput.setBounds(201, 36, 38, 20);
    panel_6.add(startInput);

    JButton gernerateScheduleButton = new JButton("Generate Schedule");
    gernerateScheduleButton.setEnabled(true);
    gernerateScheduleButton.setBounds(87, 60, 152, 23);
    panel_6.add(gernerateScheduleButton);
  }
コード例 #28
0
  public void construirInterface() {
    painel = FactoryInterface.createJPanel(0, 0, 400, 300, null);

    this.setLayout(null);
    painelGeral = new JPanel();
    painelGeral.setLayout(null);
    painelGeral.setBounds(0, 0, 400, 260);

    int x = 10;
    int y = 10;

    botaoOk = FactoryInterface.createJButton(Sap.CONCLUIR.get(), 45, 235, 150, 30, Imagem.CONCLUIR);

    botaoCancelar =
        FactoryInterface.createJButton(Sap.CANCELAR.get(), 205, 235, 150, 30, Imagem.CANCELAR);

    check0_001 = new JCheckBox(Sap.OPCOES_EXIBIR_RDF.get());
    check0_001.setBounds(x, y, 380, 20);
    y += 25;

    check0_003 = new JCheckBox(Sap.OPCOES_EXIBIR_METADADOS_DESCONHECIDOS.get());
    check0_003.setBounds(x, y, 380, 30);
    y += 25;

    labelDominio = FactoryInterface.createJLabel(Sap.DOMINIO.get(), x, y, 380, 20);
    y += 25;

    dominios.setBounds(x, y, 380, 30);
    y += 25;

    painelGeral.add(check0_001);
    painelGeral.add(check0_003);
    painelGeral.add(labelDominio);
    painelGeral.add(dominios);

    painelGeracao = new JPanel();
    painelGeracao.setLayout(null);
    painelGeracao.setBounds(0, 0, 400, 260);
    y = 10;
    label0_004 = FactoryInterface.createJLabel(Sap.URI.get(), x, y, 380, 20);
    y += 23;
    caixa0_004 = FactoryInterface.createTextField(x, y, 380, 30);

    y += 33;
    check0_005 = FactoryInterface.createJCkeckBox(x, y, 380, 20);
    check0_005.setText(Sap.OPCOES_GERAR_RDF_FORMATO.get());

    painelGeracao.add(label0_004);
    painelGeracao.add(caixa0_004);
    painelGeracao.add(check0_005);

    abas = new JTabbedPane(JTabbedPane.TOP);
    abas.addTab(Sap.OPCOES_GERAL.get(), painelGeral);
    abas.addTab(Sap.OPCOES_GERACAO.get(), painelGeracao);
    abas.setBounds(0, 0, 400, 220);
    painel.add(abas);
    painel.add(botaoOk);
    painel.add(botaoCancelar);

    this.add(painel);
  }
コード例 #29
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);
          }
        });
  }