-
-
Save crzye8s/3864231 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.swing.*; | |
| import java.awt.*; | |
| import java.awt.event.ActionEvent; | |
| import java.awt.event.ActionListener; | |
| /** | |
| * Owner: Justin | |
| * Date: 10/8/12 | |
| * Time: 10:43 PM | |
| */ | |
| public class ImageZoom implements ActionListener { | |
| private JFrame windowFrame; | |
| private JPanel buttonPanel; | |
| private JButton openButton; | |
| public static void main(String[] args) { | |
| ImageZoom imageZoomApp = new ImageZoom(); | |
| imageZoomApp.createWindow(); | |
| imageZoomApp.createElements(); | |
| } | |
| public void createWindow() { | |
| windowFrame = new JFrame("Testing"); | |
| windowFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); | |
| windowFrame.setPreferredSize(new Dimension(640, 480)); | |
| windowFrame.setVisible(true); | |
| } | |
| public void createElements() { | |
| buttonPanel = new JPanel(); | |
| buttonPanel.setPreferredSize(new Dimension(640, 100)); | |
| openButton = new JButton("Open Image"); | |
| openButton.setPreferredSize(new Dimension(120, 25)); | |
| openButton.setActionCommand("openImage"); | |
| // Todo add action listener to our openButton | |
| buttonPanel.add(openButton); | |
| // Todo add element for controlling zoom | |
| // Todo add new panel for image | |
| windowFrame.add(buttonPanel); | |
| windowFrame.pack(); | |
| } | |
| @Override | |
| public void actionPerformed(ActionEvent e) { | |
| // Todo listen for action "openImage" - open file dialog and load image created in createElements method | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment