-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45e1845
commit b5a27b4
Showing
100 changed files
with
2,453 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package Transformer; | ||
|
||
import java.awt.Graphics2D; | ||
|
||
import shapeTools.GShapeTool; | ||
|
||
public class GMover extends GTransformer { | ||
|
||
public GMover(GShapeTool selectedShape) { | ||
super(selectedShape); | ||
} | ||
|
||
@Override | ||
public void initTransforming(Graphics2D graphics2d, int x, int y) { | ||
this.selectedShape.initTransform(graphics2d, x, y); | ||
this.px = x; | ||
this.py = y; | ||
} | ||
|
||
@Override | ||
public void keepTransforming(Graphics2D graphics2d, int x, int y) { | ||
this.selectedShape.move(graphics2d, x - px, y - py); | ||
this.px = x; | ||
this.py = y; | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package Transformer; | ||
|
||
import java.awt.Graphics2D; | ||
import java.awt.Point; | ||
|
||
import shapeTools.GShapeTool; | ||
|
||
public class GResizer extends GTransformer { | ||
|
||
public GResizer(GShapeTool selectedShape) { | ||
super(selectedShape); | ||
} | ||
|
||
@Override | ||
public void initTransforming(Graphics2D graphics2d, int x, int y) { | ||
this.selectedShape.initTransform(graphics2d, x, y); | ||
this.px = x; | ||
this.py = y; | ||
} | ||
|
||
@Override | ||
public void keepTransforming(Graphics2D graphics2d, int x, int y) { | ||
this.selectedShape.resize(graphics2d, new Point(px, py), new Point(x, y)); | ||
this.px = x; | ||
this.py = y; | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package Transformer; | ||
|
||
import java.awt.Graphics2D; | ||
import java.awt.Point; | ||
|
||
import shapeTools.GShapeTool; | ||
|
||
public class GRotator extends GTransformer { | ||
|
||
public GRotator(GShapeTool selectedShape) { | ||
super(selectedShape); | ||
} | ||
|
||
@Override | ||
public void initTransforming(Graphics2D graphics2d, int x, int y) { | ||
this.selectedShape.initTransform(graphics2d, x, y); | ||
this.px = x; | ||
this.py = y; | ||
} | ||
|
||
@Override | ||
public void keepTransforming(Graphics2D graphics2d, int x, int y) { | ||
this.selectedShape.rotate(graphics2d, new Point(px, py), new Point(x, y)); | ||
this.px = x; | ||
this.py = y; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package Transformer; | ||
|
||
import java.awt.Graphics2D; | ||
|
||
import shapeTools.GShapeTool; | ||
|
||
public abstract class GTransformer { | ||
|
||
protected GShapeTool selectedShape; | ||
protected int px, py; | ||
|
||
public GTransformer(GShapeTool selectedShape) { | ||
this.selectedShape = selectedShape; | ||
} | ||
|
||
public abstract void initTransforming(Graphics2D graphics2d, int x, int y); | ||
|
||
public abstract void keepTransforming(Graphics2D graphics2d, int x, int y); | ||
|
||
public void finishTransforming(Graphics2D graphics2d, int x, int y) { | ||
|
||
} | ||
|
||
public void continueTransforming(Graphics2D graphics2d, int x, int y) { | ||
|
||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
package frame; | ||
|
||
import java.awt.BorderLayout; | ||
import java.awt.LayoutManager; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.WindowEvent; | ||
import java.awt.event.WindowListener; | ||
import java.io.File; | ||
|
||
import javax.sound.sampled.AudioInputStream; | ||
import javax.sound.sampled.AudioSystem; | ||
import javax.sound.sampled.Clip; | ||
import javax.swing.JFrame; | ||
import javax.swing.SwingUtilities; | ||
import javax.swing.UIManager; | ||
|
||
import main.GConstants.CFrame; | ||
|
||
public class GFrame extends JFrame { | ||
// attributes | ||
private static final long serialVersionUID = 1L; | ||
|
||
// components (Aggregation HierarchyÀÇ Àڽĵé) | ||
private GPanel panel; | ||
private GToolBar toolBar; | ||
private GMenuBar menuBar; | ||
private WindowHandler windowHandler; | ||
private ActionListener themeActionListener; | ||
File file = new File("src/graphicsEditorA/sound_effect_1.wav"); | ||
|
||
public GFrame() { | ||
// initialize attributes | ||
this.setLocation(CFrame.point); | ||
this.setSize(CFrame.dimension); | ||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
this.setLocationRelativeTo(null); | ||
|
||
setTitle("Graphics Editor"); | ||
|
||
this.windowHandler = new WindowHandler(); | ||
this.addWindowListener(windowHandler); | ||
this.themeActionListener = new ThemeActionHandler(); | ||
|
||
// initialize components | ||
this.menuBar = new GMenuBar(this.themeActionListener); | ||
this.setJMenuBar(this.menuBar); | ||
LayoutManager layoutManager = new BorderLayout(); | ||
this.getContentPane().setLayout(layoutManager); | ||
|
||
this.toolBar = new GToolBar(); | ||
this.getContentPane().add(this.toolBar, BorderLayout.NORTH); | ||
|
||
this.panel = new GPanel(); | ||
this.getContentPane().add(this.panel, BorderLayout.CENTER); | ||
|
||
// set associations | ||
this.menuBar.setAssociation(this.panel); | ||
this.toolBar.setAssociation(this.panel); | ||
} | ||
|
||
public void initialize() { | ||
this.toolBar.initialize(); | ||
this.panel.initialize(); | ||
} | ||
|
||
public void setTheme(String theme) { | ||
try { | ||
UIManager.setLookAndFeel(theme); | ||
SwingUtilities.updateComponentTreeUI(this); | ||
} catch (Exception e) { | ||
} | ||
} | ||
|
||
public class ThemeActionHandler implements ActionListener { | ||
public void actionPerformed(ActionEvent e1) { | ||
setTheme(e1.getActionCommand()); | ||
// System.out.println(file.exists()); | ||
try { | ||
AudioInputStream stream = AudioSystem.getAudioInputStream(file); | ||
Clip clip = AudioSystem.getClip(); | ||
clip.open(stream); | ||
clip.start(); | ||
} catch (Exception e2) { | ||
e2.printStackTrace(); | ||
} | ||
} | ||
} | ||
|
||
private class WindowHandler implements WindowListener { | ||
|
||
@Override | ||
public void windowActivated(WindowEvent arg0) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void windowClosed(WindowEvent arg0) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void windowClosing(WindowEvent arg0) { | ||
menuBar.windowExit(); | ||
} | ||
|
||
@Override | ||
public void windowDeactivated(WindowEvent arg0) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void windowDeiconified(WindowEvent arg0) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void windowIconified(WindowEvent arg0) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void windowOpened(WindowEvent arg0) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package frame; | ||
|
||
import java.awt.event.ActionListener; | ||
|
||
import javax.swing.JMenuBar; | ||
|
||
import main.GConstants.EMenu; | ||
import menu.GColorMenu; | ||
import menu.GEditMenu; | ||
import menu.GFileMenu; | ||
import menu.GHelpMenu; | ||
|
||
public class GMenuBar extends JMenuBar { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private GFileMenu fileMenu; | ||
private GEditMenu editMenu; | ||
private GHelpMenu helpMenu; | ||
private GColorMenu colorMenu; | ||
|
||
public GMenuBar(ActionListener themeActionListener) { | ||
this.fileMenu = new GFileMenu(EMenu.eFile.getText()); | ||
this.add(this.fileMenu); | ||
|
||
this.editMenu = new GEditMenu(EMenu.eEdit.getText()); | ||
this.add(this.editMenu); | ||
|
||
this.colorMenu = new GColorMenu(EMenu.eColor.getText(), themeActionListener); | ||
this.add(this.colorMenu); | ||
|
||
this.helpMenu = new GHelpMenu(EMenu.eHelp.getText()); | ||
this.add(this.helpMenu); | ||
} | ||
|
||
// public GMenuBar() { | ||
// for (EMenu eMenu: EMenu.values()) { | ||
// JMenu menu = new GFileMenu(eMenu.getText()); | ||
// this.add(menu); | ||
// } | ||
// } | ||
|
||
public void setAssociation(GPanel panel) { | ||
this.fileMenu.setAssociation(panel); | ||
this.editMenu.setAssociation(panel); | ||
this.colorMenu.setAssociation(panel); | ||
this.helpMenu.setAssociation(panel); | ||
} | ||
|
||
public void windowExit() { | ||
this.fileMenu.exitProgram(); | ||
|
||
} | ||
} |
Oops, something went wrong.