Exemplo n.º 1
0
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   Component c =
       tableCellRenderer.getTableCellRendererComponent(
           table, value, isSelected, hasFocus, row, column);
   if (c instanceof JLabel) {
     JLabel l = (JLabel) c;
     l.setHorizontalTextPosition(JLabel.LEFT);
     int modelColumn = table.convertColumnIndexToModel(column);
     l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
   }
   return c;
 }
Exemplo n.º 2
0
  /** Create the frame */
  public DateTimer() {
    super();
    setTitle("v14 CountDown");
    getContentPane().setLayout(null);
    setBounds(100, 100, 500, 375);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final JLabel finishtimeLabel = new JLabel();
    finishtimeLabel.setText("CountDown Time");
    finishtimeLabel.setBounds(10, 36, 119, 15);
    getContentPane().add(finishtimeLabel);
    finishtime =
        new JFormattedTextField(
            new DateFormatter(new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa", Locale.ENGLISH)));
    finishtime.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {}
        });

    finishtime.setValue(new Date());
    finishtime.setBounds(135, 34, 187, 19);
    getContentPane().add(finishtime);

    final JButton startButton = new JButton();
    startButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            startCount();
          }
        });
    startButton.setText("Start!!!");
    startButton.setBounds(334, 31, 111, 25);
    getContentPane().add(startButton);

    countLabel = new JLabel();
    countLabel.setHorizontalAlignment(SwingConstants.CENTER);
    countLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    countLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 14));
    countLabel.setBorder(new LineBorder(Color.black, 1, false));
    countLabel.setText("Countdown not Started");
    countLabel.setBounds(10, 162, 435, 47);
    getContentPane().add(countLabel);

    final JLabel credits = new JLabel();
    credits.setHorizontalAlignment(SwingConstants.RIGHT);
    credits.setText("");
    credits.setBounds(253, 328, 237, 15);
    getContentPane().add(credits);
  }
Exemplo n.º 3
0
  public Pregunta13(int s) {

    this.s = s;
    pregunta = 13;

    setLayout(null);
    setBounds(150, 5, 1080, 720);

    preguntinis = "13. Es una caracteristica del socialismo:";

    resp13 = new String[4];
    resp13[0] = "Comercio controlado por el sector privado";
    resp13[1] = "Comercio controlado por el Gobierno";
    resp13[2] = "Diferencias de clases sociales";
    resp13[3] = "El empleo es bien pagado";

    opc1 = new JButton(resp13[0]);
    opc1.setBounds(50, 300, 290, 30);
    opc1.addActionListener(this);
    add(opc1);

    opc2 = new JButton(resp13[1]);
    opc2.setBounds(50, 350, 290, 30);
    opc2.addActionListener(this);
    add(opc2);

    opc3 = new JButton(resp13[2]);
    opc3.setBounds(50, 400, 290, 30);
    opc3.addActionListener(this);
    add(opc3);

    opc4 = new JButton(resp13[3]);
    opc4.setBounds(50, 450, 290, 30);
    opc4.addActionListener(this);
    add(opc4);

    titulo = new JLabel(preguntinis, SwingConstants.CENTER);
    titulo.setFont(new Font("Century Ghotic", Font.BOLD, 20));
    titulo.setBounds(0, 90, 1080, 50);
    titulo.setHorizontalTextPosition(SwingConstants.CENTER);
    add(titulo);

    puntua = new JLabel("Score: " + s);
    puntua.setFont(new Font("Century Ghotic", Font.BOLD, 17));
    puntua.setBounds(910, 600, 1080, 50);
    add(puntua);

    salir = new JButton("Salir");
    salir.setBounds(50, 610, 100, 30);
    salir.addActionListener(this);
    add(salir);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    fondo = new JLabel();
    ImageIcon icon = new ImageIcon(getClass().getResource("/imagenes/imagen.jpg"));
    fondo.setIcon(icon);
    fondo.setBounds(0, 0, 1080, 720);
    add(fondo);

    setVisible(true);
  }
  private void makeAndSetTabComponents() {
    final String[] tabTitles = {"Libraries", "Modes", "Tools", "Examples", "Updates"};
    tabLabels = new JLabel[4];

    for (int i = 0; i < 4; i++) {
      final int temp = i;
      tabLabels[i] =
          new JLabel(tabTitles[i]) {
            @Override
            protected void paintComponent(Graphics g) {
              g.setClip(
                  Toolkit.createRoundRect(
                      0, 0, getWidth(), getHeight(), temp == 0 ? 6 : 0, temp == 3 ? 6 : 0, 0, 0));
              super.paintComponent(g);
            }
          };
      tabLabels[i].setForeground(Color.WHITE);
      tabLabels[i].setBackground(new Color(0x2d4251));
      tabLabels[i].setOpaque(true);
      tabLabels[i].setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
      tabLabels[i].setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
      tabLabels[i].setHorizontalAlignment(SwingConstants.CENTER);
      tabLabels[i].setFont(Toolkit.getSansFont(14, Font.BOLD));
      tabbedPane.setTabComponentAt(i, tabLabels[i]);
    }

    updateTabPanel =
        new JPanel() {
          @Override
          protected void paintComponent(Graphics g) {
            g.setClip(Toolkit.createRoundRect(0, 0, getWidth(), getHeight(), 6, 6, 0, 0));
            super.paintComponent(g);
          }
        };
    ;
    updateTabLabel = new JLabel("Updates");
    updateTabLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
    numberLabel.setVerticalTextPosition(SwingConstants.CENTER);
    numberLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    numberLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
    numberLabel.setForeground(Color.WHITE);
    updateTabPanel.setOpaque(true);
    updateTabPanel.setBackground(new Color(0x2d4251));
    updateTabLabel.setForeground(Color.WHITE);
    updateTabPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
    updateTabPanel.setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
    tabbedPane.setTabComponentAt(4, updateTabPanel);

    GroupLayout tabLayout = new GroupLayout(updateTabPanel);
    tabLayout.setAutoCreateGaps(true);
    updateTabPanel.setLayout(tabLayout);
    tabLayout.setHorizontalGroup(
        tabLayout
            .createSequentialGroup()
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
            .addComponent(updateTabLabel)
            .addComponent(numberLabel)
            .addPreferredGap(
                LayoutStyle.ComponentPlacement.RELATED,
                GroupLayout.PREFERRED_SIZE,
                Short.MAX_VALUE));
    tabLayout.setVerticalGroup(
        tabLayout
            .createParallelGroup(GroupLayout.Alignment.CENTER)
            .addComponent(numberLabel)
            .addComponent(updateTabLabel));

    numberLabel.setVisible(false);
  }
Exemplo n.º 5
0
 void jbInit() throws Exception {
   panel1.setLayout(borderLayout1);
   jPanel1.setBorder(BorderFactory.createEtchedBorder());
   jPanel1.setPreferredSize(new Dimension(14, 100));
   jPanel1.setLayout(borderLayout2);
   jPanel2.setBorder(BorderFactory.createEtchedBorder());
   jPanel2.setPreferredSize(new Dimension(10, 40));
   jPanel2.setLayout(gridBagLayout1);
   jLabel2.setText("Oznaka banke:");
   bPronadji.setPreferredSize(new java.awt.Dimension(80, 27));
   bPronadji.setText("Pronadji ");
   bPronadji.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           bPronadji_actionPerformed(e);
         }
       });
   bIzlaz.setPreferredSize(new Dimension(80, 27));
   bIzlaz.setText("Izlaz");
   bIzlaz.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           bIzlaz_actionPerformed(e);
         }
       });
   txtOznakaBanke.setPreferredSize(new Dimension(120, 21));
   getContentPane().add(panel1);
   panel1.add(jPanel1, BorderLayout.NORTH);
   {
     jLabel1 = new JLabel();
     jPanel1.add(jLabel1, BorderLayout.CENTER);
     jLabel1.setText("PREGLED FILIJALA BANKE");
     jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 18));
     jLabel1.setPreferredSize(new java.awt.Dimension(588, 96));
     jLabel1.setHorizontalTextPosition(SwingConstants.CENTER);
     jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
     jLabel1.setVerticalAlignment(SwingConstants.TOP);
     {
       jLabel3 = new JLabel();
       jLabel1.add(jLabel3);
       jLabel3.setText("NAZIV:");
       jLabel3.setBounds(7, 49, 42, 28);
       jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 12));
     }
     {
       jLabel4 = new JLabel();
       jLabel1.add(jLabel4);
       jLabel4.setText("ADRESA:");
       jLabel4.setBounds(280, 49, 63, 28);
       jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 12));
     }
     {
       jLnazivBanke = new JLabel();
       jLabel1.add(jLnazivBanke);
       jLnazivBanke.setBounds(56, 49, 203, 28);
     }
     {
       jLadresaBanke = new JLabel();
       jLabel1.add(jLadresaBanke);
       jLadresaBanke.setBounds(336, 49, 238, 28);
     }
   }
   panel1.add(jPanel2, BorderLayout.SOUTH);
   jPanel2.add(
       jLabel2,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   jPanel2.add(
       txtOznakaBanke,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(0, 10, 0, 0),
           0,
           0));
   jPanel2.add(
       bPronadji,
       new GridBagConstraints(
           5,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 10, 0, 0),
           0,
           0));
   jPanel2.add(
       bIzlaz,
       new GridBagConstraints(
           5,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 200, 0, 0),
           0,
           0));
   panel1.add(jScrollPane1, BorderLayout.CENTER);
   jScrollPane1.getViewport().add(tabBanke, null);
   TModelPrijave tMP = new TModelPrijave(tabBanke);
   tabBanke.setModel(tMP);
   ((TModelPrijave) tabBanke.getModel()).initColumns();
 }
Exemplo n.º 6
0
  public Pregunta24(int s) {

    this.s = s;
    pregunta = 24;

    setLayout(null);
    setBounds(150, 5, 1080, 720);

    preguntinis = "24. ¿Cuál opción incluye los tres sectores sociales?";

    resp24 = new String[4];
    resp24[0] = "Agropecuario, Industrial y de Servicios";
    resp24[1] = "Agropecuario, de Servicios y Comunicaciones";
    resp24[2] = "Transporte, Comunicaciones y Sevicios";
    resp24[3] = "Servicios, Comunicaciones y Cableado";

    opc1 = new JButton(resp24[0]);
    opc1.setBounds(50, 300, 290, 30);
    opc1.addActionListener(this);
    add(opc1);

    opc2 = new JButton(resp24[1]);
    opc2.setBounds(50, 350, 290, 30);
    opc2.addActionListener(this);
    add(opc2);

    opc3 = new JButton(resp24[2]);
    opc3.setBounds(50, 400, 290, 30);
    opc3.addActionListener(this);
    add(opc3);

    opc4 = new JButton(resp24[3]);
    opc4.setBounds(50, 450, 290, 30);
    opc4.addActionListener(this);
    add(opc4);

    titulo = new JLabel(preguntinis, SwingConstants.CENTER);
    titulo.setFont(new Font("Century Ghotic", Font.BOLD, 20));
    titulo.setBounds(0, 90, 1080, 50);
    titulo.setHorizontalTextPosition(SwingConstants.CENTER);
    add(titulo);

    puntua = new JLabel("Score: " + s);
    puntua.setFont(new Font("Century Ghotic", Font.BOLD, 17));
    puntua.setBounds(910, 600, 1080, 50);
    add(puntua);

    salir = new JButton("Salir");
    salir.setBounds(50, 610, 100, 30);
    salir.addActionListener(this);
    add(salir);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    fondo = new JLabel();
    ImageIcon icon = new ImageIcon(getClass().getResource("/imagenes/imagen.jpg"));
    fondo.setIcon(icon);
    fondo.setBounds(0, 0, 1080, 720);
    add(fondo);

    setVisible(true);
  }
Exemplo n.º 7
0
  public Pregunta15(int s) {

    this.s = s;
    pregunta = 15;

    setLayout(null);
    setBounds(150, 5, 1080, 720);

    preguntinis =
        "15. Durante la segunda guerra mundial, ¿Cuál de los siguientes paises pertenecia a los paises aliados?";

    resp15 = new String[4];
    resp15[0] = "Francía";
    resp15[1] = "Alemania";
    resp15[2] = "México";
    resp15[3] = "Italia";

    opc1 = new JButton(resp15[0]);
    opc1.setBounds(50, 300, 290, 30);
    opc1.addActionListener(this);
    add(opc1);

    opc2 = new JButton(resp15[1]);
    opc2.setBounds(50, 350, 290, 30);
    opc2.addActionListener(this);
    add(opc2);

    opc3 = new JButton(resp15[2]);
    opc3.setBounds(50, 400, 290, 30);
    opc3.addActionListener(this);
    add(opc3);

    opc4 = new JButton(resp15[3]);
    opc4.setBounds(50, 450, 290, 30);
    opc4.addActionListener(this);
    add(opc4);

    titulo = new JLabel(preguntinis, SwingConstants.CENTER);
    titulo.setFont(new Font("Century Ghotic", Font.BOLD, 20));
    titulo.setBounds(0, 90, 1080, 50);
    titulo.setHorizontalTextPosition(SwingConstants.CENTER);
    add(titulo);

    puntua = new JLabel("Score: " + s);
    puntua.setFont(new Font("Century Ghotic", Font.BOLD, 17));
    puntua.setBounds(910, 600, 1080, 50);
    add(puntua);

    salir = new JButton("Salir");
    salir.setBounds(50, 610, 100, 30);
    salir.addActionListener(this);
    add(salir);

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    fondo = new JLabel();
    ImageIcon icon = new ImageIcon(getClass().getResource("/imagenes/imagen.jpg"));
    fondo.setIcon(icon);
    fondo.setBounds(0, 0, 1080, 720);
    add(fondo);

    setVisible(true);
  }