Skip to content

Commit

Permalink
Fix bug where frame would only diplays image height. Now it displays
Browse files Browse the repository at this point in the history
height and width. Continued work on canvas settigns
  • Loading branch information
Dakkra committed Jun 30, 2015
1 parent 6560242 commit 22a1d04
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
Expand Up @@ -106,7 +106,7 @@ public Canvas(MainWindow mw, BufferedImage image) {

public void updateTitle() {
int zoom = drawPane.getZoom();
frame.setTitle(imageName + ": " + "(" + canvasHeight + "," + canvasHeight + ") " + "(" + zoom + "x)");
frame.setTitle(imageName + ": " + "(" + canvasWidth + "," + canvasHeight + ") " + "(" + zoom + "x)");
}

public void updateMousePos(int x, int y) {
Expand Down
Expand Up @@ -2,6 +2,8 @@

import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JInternalFrame;
Expand Down Expand Up @@ -30,7 +32,7 @@ public void cnsGUI() {

JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu(" File ");
JMenuItem fileSave = new JMenuItem(" Save ");
JMenuItem fileSave = new JMenuItem("Save");
JMenuItem fileExit = new JMenuItem("Exit");
fileMenu.add(fileSave);
fileMenu.addSeparator();
Expand All @@ -55,8 +57,10 @@ public void cnsGUI() {
buttonContainer.setLayout(new FlowLayout(FlowLayout.CENTER));

JButton saveButton = new JButton("Save");
saveButton.addActionListener(new SaveEar());

JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new CancelEar());

buttonContainer.add(saveButton);
buttonContainer.add(cancelButton);
Expand All @@ -74,4 +78,22 @@ public void cnsGUI() {
mw.addIFrame(frame);
}

private class CancelEar implements ActionListener {

@Override
public void actionPerformed(ActionEvent e) {
// TODO soemthign here
}

}

private class SaveEar implements ActionListener {

@Override
public void actionPerformed(ActionEvent e) {
// TODO soemthign here
}

}

}
4 changes: 3 additions & 1 deletion src/main/java/com/dakkra/pyxleos/ui/MainWindow.java
Expand Up @@ -275,7 +275,9 @@ public void updateNimbus() {
UIManager.put("nimbusFocus", baseColor.brighter());
UIManager.put("nimbusSelectionBackground", baseRedColor);

UIManager.put("DesktopPane[Enabled].backgroundPainter", new DesktopPainter(uis));
DesktopPainter dp = new DesktopPainter(uis);

UIManager.put("DesktopPane[Enabled].backgroundPainter", dp);
}

private void loadColorSettings() {
Expand Down
Expand Up @@ -17,10 +17,12 @@ public class DesktopPainter implements Painter<JDesktopPane> {
public DesktopPainter(UISettings uis) {
this.uis = uis;
image = uis.getbgImage();
System.out.println("bg painter init");
}

@Override
public void paint(Graphics2D g, JDesktopPane object, int width, int height) {
// TODO find out why nimbus doesn't render this painter
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.drawImage(image, 0, 0, width, height, null);
Expand Down

0 comments on commit 22a1d04

Please sign in to comment.