Exemple #1
0
  public ColorMenu(JFrame frame, int players) {
    this.frame = frame;
    numPlayers = players;

    try {
      kenVector25 =
          Font.createFont(Font.TRUETYPE_FONT, new File("fonts/kenvector_future.ttf"))
              .deriveFont(25f);
      kenVector16 =
          Font.createFont(Font.TRUETYPE_FONT, new File("fonts/kenvector_future.ttf"))
              .deriveFont(16f);
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      // register the font
      ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("fonts/kenvector_future.ttf")));
      ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("fonts/kenvector_future.ttf")));
    } catch (IOException e) {
      e.printStackTrace();
    } catch (FontFormatException e) {
      e.printStackTrace();
    }

    initializeComponents();
    createGUI();
    addEvents();
  }
 /*Load font for use with labels*/
 private void loadFont() {
   // load font
   try {
     // create the font to use
     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
     // register the font
     ge.registerFont(
         Font.createFont(Font.TRUETYPE_FONT, new File("assets\\fonts\\Sen-Regular.ttf")));
   } catch (IOException ex) {
     Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
   } catch (FontFormatException ex) {
     Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
Exemple #3
0
  public shit() {
    this.addWindowListener(this);
    setSize(1280, 720);
    setVisible(true);

    r = new Random();
    //		ap = new AudioPlayer();//THIS SHIT DOESN'T WORK WHAT THE F**K DEHOWE
    timer = System.currentTimeMillis();
    options.add("");
    options.add("");
    options.add(""); // These 3 lines are to populate options.
    state = 1; // The first line will always be a story panel so the state is 1.
    try {
      URL url = getClass().getResource("options.png");
      obox = ImageIO.read((url));
      url = getClass().getResource("Text Boxes.png");
      textBox = ImageIO.read(url); // reads in the text boxes file.
      p = new parser("Introduction.txt"); // reads in the story file.
      progress(); // the function that calls going through to the next line
    } catch (IOException e) {
      e.printStackTrace();
    }

    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    try {
      URL url = getClass().getResource("sspr.ttf");
      ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, url.openStream()));
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    resize(SCREENWIDTH, SCREENHEIGHT); // Makes the applet the size we want it
    addMouseListener(this); // Lets us use mouse
    addKeyListener(this); // Lets us use keyboard

    Thread t = new Thread(this);
    t.start();
  }
  public PantallaPuntaje() {
    setBounds(100, 100, 590, 432);
    this.setLocationRelativeTo(PantallaPrincipal.getInstance());
    this.setResizable(false);
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    getContentPane().setLayout(null);
    JLabel label_1 = new JLabel(""); // Boton atras
    label_1.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            PantallaPrincipal.getInstance().setLocationRelativeTo(PantallaPuntaje.this);
            setVisible(false);
            PantallaPrincipal.getInstance().setVisible(true);
          }
        });

    Font font = null;
    try {
      font =
          Font.createFont(
              Font.TRUETYPE_FONT,
              getClass().getResourceAsStream("/res/fuente/VCR_OSD_MONO_1.001.ttf"));
    } catch (FontFormatException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
    genv.registerFont(font);
    font = font.deriveFont(12f);

    label_1.setIcon(new ImageIcon(PantallaAyuda.class.getResource("/res/flecha_final.png")));
    label_1.setBounds(16, 17, 52, 52);
    getContentPane().add(label_1);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK));
    scrollPane.setBounds(81, 82, 450, 231);
    getContentPane().add(scrollPane);

    Object[][] datos = new Object[MainJuego.getTopFive().size()][2];
    for (int i = 0; i < MainJuego.getTopFive().size(); i++) {
      datos[i][0] = MainJuego.getTopFive().get(i).getNombre();
      datos[i][1] = MainJuego.getTopFive().get(i).getPuntos();
    }

    String[] columnas = {"NOMBRE", " PUNTAJE"};

    DefaultTableCellRenderer Alinear = new DefaultTableCellRenderer();
    Alinear.setHorizontalAlignment(SwingConstants.CENTER);
    DefaultTableModel dtm = new DefaultTableModel(datos, columnas);

    table = new JTable(dtm);
    scrollPane.setViewportView(table);
    scrollPane.setBackground(Color.black);

    table.setBackground(Color.black);
    table.getTableHeader().setFont(font.deriveFont(Font.PLAIN, 40f));
    table.getTableHeader().setForeground(Color.YELLOW);
    table.getTableHeader().setBackground(Color.BLACK);
    table.setRowHeight(37);
    table.setFont(font.deriveFont(Font.PLAIN, 23f));
    table.setBorder(null);
    table.setForeground(Color.WHITE);
    table.setShowGrid(false);
    table.getTableHeader().setReorderingAllowed(false);
    table.getTableHeader().setResizingAllowed(false);
    table.getColumnModel().getColumn(1).setCellRenderer(Alinear);
    table.setFocusable(false);
    table.setEnabled(false);

    JLabel lblNewLabel = new JLabel("New label");
    lblNewLabel.setIcon(new ImageIcon(PantallaPuntaje.class.getResource("/res/fondo puntaje.jpg")));
    lblNewLabel.setBounds(0, 0, 590, 410);
    getContentPane().add(lblNewLabel);
    this.setResizable(false);
  }