Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package FLMain;
- /*
- *Author: Zach Karp
- *Date:
- */
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.FlowLayout;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.io.File;
- import java.io.IOException;
- import javax.imageio.ImageIO;
- import javax.swing.ButtonGroup;
- import javax.swing.ImageIcon;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JRadioButton;
- import javax.swing.RootPaneContainer;
- @SuppressWarnings("serial")
- public class FLInstall extends JFrame {
- // Panels
- private JPanel panel;
- private JPanel panel2;
- // Buttons
- private JButton installButton;
- private JButton directoryButton;
- //private JLabel messageLabel;
- // Window parameters
- private final int WINDOW_WIDTH = 512; // Window Width
- private final int WINDOW_HEIGHT = 288; // Window Height
- public FLInstall() {
- // Set the title bar text
- setTitle("FreeLancer Install");
- // Set the size of the window
- setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
- // Close window when the exit button is clicked
- setDefualtCloseOperation(JFrame.EXIT_ON_CLOSE);
- setLayout(new BorderLayout());
- try {
- rootPane.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("logo.png")))));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- //add(background);
- setLayout(new FlowLayout());
- panel2 = new JPanel();
- // Set panels background colors
- panel2.setBackground(Color.WHITE);
- // Adding the panels to the App
- add(panel2, BorderLayout.NORTH);
- // Create the buttons.
- installButton = new JButton("Install");
- directoryButton = new JButton("Choose Directory");
- // Declaring that panel2 has the buttons
- panel2.add(installButton);
- panel2.add(directoryButton);
- // Adding the action listeners to the buttons
- installButton.addActionListener(new InstallButtonListener());
- directoryButton.addActionListener(new DirectoryButtonListener());
- // Add the buttons color.
- installButton.setBackground(Color.RED);
- directoryButton.setBackground(Color.ORANGE);
- // Display the window
- setVisible(true);
- }
- // Color Button Listener Actions
- private class InstallButtonListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- panel.setBackground(Color.RED);
- }
- }
- // Color Button Listener Actions
- private class DirectoryButtonListener implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- panel.setBackground(Color.ORANGE);
- }
- }
- // Generated default close operation
- private void setDefualtCloseOperation(int exitOnClose) {
- }
- // Generated clearSelection
- public Object clearSelection() {
- return null;
- }
- // Run that thang!
- public static void main(String[] args) {
- new FLInstall();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement