import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; public class Main { static Color redish = new Color(179, 57, 81); static Color greenish = new Color(80, 193, 119); static Font bigfont; static Font smallfont; public static void bigfont(){ try{ bigfont = Font.createFont(Font.TRUETYPE_FONT, new File("Resources\\font.ttf")).deriveFont(25f); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("Resources\\font.ttf"))); } catch(IOException | FontFormatException e){ } } public static void smallfont(){ try{ smallfont = Font.createFont(Font.TRUETYPE_FONT, new File("Resources\\font2.ttf")).deriveFont(18f); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("Resources\\font2.ttf"))); } catch(IOException | FontFormatException e){ } } public void setMain(){ bigfont(); smallfont(); JFrame main = new JFrame("GymGuide"); main.setSize(300, 800); main.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); main.setResizable(false); main.getContentPane().setBackground(redish); JButton pr = new JButton("One Rep Max Calculator"); pr.setBounds(15, 40, 251, 75); pr.setForeground(redish); pr.setBackground(greenish); pr.setFont(smallfont); pr.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { main.removeAll(); main.setVisible(false); main.dispose(); OneRMCalc.setFrame(); } }); main.add(pr); JLabel title = new JLabel("Select a tool", SwingConstants.CENTER); title.setVerticalAlignment(SwingConstants.TOP); title.setForeground(greenish); title.setFont(bigfont); main.add(title); main.setVisible(true); } public static void main(String[] args) { Main m = new Main(); m.setMain(); } }