• R/O
  • SSH
  • HTTPS

noodlybox: Commit


Commit MetaInfo

Revision245 (tree)
Zeit2012-02-14 00:57:37
Autormolelord

Log Message

ウィンドウがフォアグラウンドになると自動でリロードされるようにした。

Ändern Zusammenfassung

Diff

--- trunk/workspace/TimingChartViewer/src/jp/gr/java_conf/molelord/TcvWavePanel.java (revision 244)
+++ trunk/workspace/TimingChartViewer/src/jp/gr/java_conf/molelord/TcvWavePanel.java (revision 245)
@@ -47,7 +47,8 @@
4747 this.setBackground(Color.WHITE);
4848 this.setLayout(new FlowLayout(FlowLayout.LEFT));
4949
50- parse();
50+ // FrameがActivateされた時点で行うので、ここで呼び出す必要はない。
51+ //parse();
5152 }
5253
5354 public void parse() {
--- trunk/workspace/TimingChartViewer/src/jp/gr/java_conf/molelord/TcvFrame.java (revision 244)
+++ trunk/workspace/TimingChartViewer/src/jp/gr/java_conf/molelord/TcvFrame.java (revision 245)
@@ -6,6 +6,8 @@
66 package jp.gr.java_conf.molelord;
77
88 import java.awt.*;
9+import java.awt.event.*;
10+
911 import javax.swing.*;
1012
1113 /**
@@ -16,6 +18,7 @@
1618 public class TcvFrame extends JFrame {
1719 private String filename;
1820 private static final int ButtonPanelHeight = 32;
21+ private TcvWavePanel wavePanel;
1922
2023 public TcvFrame(String title, String name) {
2124 this.filename = name;
@@ -25,12 +28,20 @@
2528 // ウィンドウ全体はBorderLayout
2629 this.setLayout(new BorderLayout());
2730
28- TcvWavePanel wavePanel = new TcvWavePanel(this.filename);
31+ wavePanel = new TcvWavePanel(this.filename);
2932 this.add(wavePanel, BorderLayout.CENTER);
3033 JPanel buttonPanel = new TcvButtonPanel(this, wavePanel);
3134 this.add(buttonPanel, BorderLayout.SOUTH);
3235
33- this.reflectComponentSize(wavePanel);
36+ // Activateされた時点で行うので、ここで呼び出す必要はない。
37+ //this.reflectComponentSize(wavePanel);
38+
39+ addWindowListener(new WindowAdapter() {
40+ public void windowActivated(WindowEvent event) {
41+ wavePanel.parse();
42+ reflectComponentSize(wavePanel);
43+ }
44+ });
3445 }
3546
3647 /**
--- trunk/workspace/TimingChartViewer/src/jp/gr/java_conf/molelord/TcvButtonPanel.java (revision 244)
+++ trunk/workspace/TimingChartViewer/src/jp/gr/java_conf/molelord/TcvButtonPanel.java (revision 245)
@@ -15,24 +15,24 @@
1515 */
1616 @SuppressWarnings("serial")
1717 public class TcvButtonPanel extends JPanel {
18- private TcvFrame parentFrame;
18+// private TcvFrame parentFrame;
1919 private TcvWavePanel wavePanel;
2020
2121 public TcvButtonPanel(TcvFrame frame, TcvWavePanel panel) {
22- this.parentFrame = frame;
22+// this.parentFrame = frame;
2323 this.wavePanel = panel;
2424
2525 this.setLayout(new FlowLayout(FlowLayout.LEFT));
2626
27- JButton buttonReload = new JButton("Reload");
28- buttonReload.addActionListener(new ActionListener() {
29- public void actionPerformed(ActionEvent event) {
30- wavePanel.parse();
31- parentFrame.reflectComponentSize(wavePanel);
32- //wavePanel.repaint();
33- }
34- });
35- this.add(buttonReload);
27+// JButton buttonReload = new JButton("Reload");
28+// buttonReload.addActionListener(new ActionListener() {
29+// public void actionPerformed(ActionEvent event) {
30+// wavePanel.parse();
31+// parentFrame.reflectComponentSize(wavePanel);
32+// //wavePanel.repaint();
33+// }
34+// });
35+// this.add(buttonReload);
3636
3737 JButton buttonClip = new JButton("Copy");
3838 buttonClip.addActionListener(new ActionListener() {
Show on old repository browser