The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
Action Event Issue
Posted by: Martin | December 3, 2010 @ 7:42am
Java Code
[
Download
]
//Main Class public class main { public static void main(String args[]){ javax.swing.SwingUtilities.invokeLater(new Runnable(){ public void run(){ Loader l = new Loader(); } }); } } // Loader Class import java.awt.event.ActionEvent; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Desktop.Action; import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import java.awt.*; public class Loader { /** * */ private static final long serialVersionUID = 1L; //Gave a warning so we let Eclipse help us out. No idea what this means. // variables for our GUI private JLabel headLine; private JLabel file1; private JLabel file2; public static String file1Name = "init"; public CharSequence file1Short; public CharSequence file2Short; public static String file2Name = "init"; private JButton click; private JButton click2; public static File selectedFile1; public static File selectedFile2; private static int length; public Loader(){ JFrame mainFrame = new JFrame("Orchestration analyzer"); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = mainFrame.getContentPane(); JPanel mainPanel = new JPanel(); contentPane.add(mainPanel); JPanel lineStartPanel = new JPanel(); contentPane.add(lineStartPanel,BorderLayout.LINE_START); click = (JButton) mainPanel.add(new JButton("Load Data")); click2 = (JButton) mainPanel.add(new JButton("Load Midi")); mainFrame.pack(); mainFrame.setVisible(true); } //Action Event Handler ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { click = (JButton) actionEvent.getSource(); if(actionEvent.getSource() == click){ System.out.print("Button is working"); } } }; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.73 / 8
33 Votes
http://codebin.yi.org/992
page generated in 0.01 seconds