初期コードの微調整

  App.java



  
// *********************************************
// プロジェクト名 : DB_01
// *********************************************

package db_01;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

// *********************************************
// このアプリケーションのメインクラス
// *********************************************
public class DB_01App extends SingleFrameApplication {

	// *********************************************
	// 開始処理( メインウインドウを表示 )
	// *********************************************
	@Override protected void startup() {
		DB_01View startView = new DB_01View(this);
		show(startView);
		// サイズ変更
		startView.getFrame().setSize(800, 600);
		// 位置変更
		startView.getFrame().setLocation(0, 0);
	}

	@Override protected void configureWindow(java.awt.Window root) {
	}

	public static DB_01App getApplication() {
		return Application.getInstance(DB_01App.class);
	}

	// *********************************************
	// エントリポイント
	// *********************************************
	public static void main(String[] args) {
		launch(DB_01App.class, args);
	}
}
  

  
DB_01View startView = new DB_01View(this);
show(startView);
// サイズ変更
startView.getFrame().setSize(800, 600);
// 位置変更
startView.getFrame().setLocation(0, 0);
  



  View.java



  
// *********************************************
// メインウインドウ
// *********************************************

package db_01;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;

public class DB_01View extends FrameView {

	// *********************************************
	// コンストラクタ
	// *********************************************
	public DB_01View(SingleFrameApplication app) ...

	// *********************************************
	// ダイアログ
	// *********************************************
	@Action
	public void showAboutBox() {
		if (aboutBox == null) {
			JFrame mainFrame = DB_01App.getApplication().getMainFrame();
			aboutBox = new DB_01AboutBox(mainFrame);
			aboutBox.setLocationRelativeTo(mainFrame);
		}
		aboutBox.setVisible(true);
		// DB_01App.getApplication().show(aboutBox);
	}

	// *********************************************
	// 変更不可
	// *********************************************
	private void initComponents() ...

	// Variables declaration - do not modify
	private javax.swing.JPanel mainPanel;
	private javax.swing.JMenuBar menuBar;
	private javax.swing.JProgressBar progressBar;
	private javax.swing.JLabel statusAnimationLabel;
	private javax.swing.JLabel statusMessageLabel;
	private javax.swing.JPanel statusPanel;
	// End of variables declaration

	private final Timer messageTimer;
	private final Timer busyIconTimer;
	private final Icon idleIcon;
	private final Icon[] busyIcons = new Icon[15];
	private int busyIconIndex = 0;

	private JDialog aboutBox;
}
  



  AboutBox.java

  
// *********************************************
// ダイアログ
// *********************************************

package db_01;

import org.jdesktop.application.Action;

public class DB_01AboutBox extends javax.swing.JDialog {

	private java.awt.Frame pw = null;
	private javax.swing.JLabel sts_text = null;
		
	// *********************************************
	// コンストラクタ
	// *********************************************
	public DB_01AboutBox(java.awt.Frame parent,javax.swing.JLabel text) {
		super(parent);
		initComponents();
		getRootPane().setDefaultButton(closeButton);
		pw = parent;
		sts_text = text;
	}
	
	private void closeAction() {
		JOptionPane.showMessageDialog(pw,"ダイアログが閉じられます");
		sts_text.setText("ダイアログが閉じられました");
	}

	@Action public void closeAboutBox() {
		setVisible(false);
		closeAction();
	}

	// *********************************************
	// 変更不可
	// *********************************************
	private void initComponents() ...

	// *********************************************
	// イベント追加で作成されたブロック
	// *********************************************
	private void windowColsed(java.awt.event.WindowEvent evt) {
		// TODO add your handling code here:
		closeAction();
	}

	// Variables declaration - do not modify
	private javax.swing.JButton closeButton;
	// End of variables declaration

}
  










  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ