|
readme.txt
|
package myswing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CLWin extends JFrame {
Container MainArea = null;
public JPanel Client = new JPanel(); // クライアント領域
JPanel StatusArea = new JPanel(); // ステータスバー領域
public JLabel Status = new JLabel("ステータスバー");
public JMenuBar MenuBar = new JMenuBar();
public int RowPitch = 25;
public int BaseLine = 1;
public int BasePosition = 0;
// コンストラクタ
public CLWin() {
this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
this.setSize(800,600);
MainArea = this.getContentPane();
MainArea.add(Client,BorderLayout.CENTER);
MainArea.add(StatusArea,BorderLayout.SOUTH);
Client.setLayout( null );
StatusArea.setBorder( BorderFactory.createLineBorder( Color.GRAY ));
StatusArea.setLayout( new FlowLayout( FlowLayout.LEFT ));
StatusArea.add( Status );
Status.setFont(new Font("MS Pゴシック", 0, 12));
}
// ウインドウの中央移動
public void CenterWindow() {
Toolkit Tool;
Dimension DesktopSize;
Dimension WindowSize;
Tool = this.getToolkit();
DesktopSize = Tool.getScreenSize();
WindowSize = this.getSize();
this.move(
(DesktopSize.width-WindowSize.width)/2,
(DesktopSize.height-WindowSize.height)/2
);
}
// ボタン実装 (1)
public void AddButton(ActionListener MyEvent, LboxButton LButton) {
Client.add( LButton );
LButton.addActionListener(MyEvent);
}
// ボタン実装 (2)
public void AddButton(ActionListener MyEvent, LboxButton LButton, int x, int y ) {
LButton.setLocation(BasePosition+x,(BaseLine+y)*RowPitch+5);
Client.add( LButton );
LButton.addActionListener(MyEvent);
}
// ラベル実装
public void AddLabel(LboxLabel LLabel, int x, int y ) {
LLabel.setLocation(BasePosition+x,(BaseLine+y)*RowPitch+5);
Client.add( LLabel );
}
// エディトコントロール実装
public void AddEdit(LboxEdit LEdit, int x, int y ) {
LEdit.setLocation(BasePosition+x,(BaseLine+y)*RowPitch+5);
Client.add( LEdit );
}
// コンボボックス実装
public void AddCombo(ActionListener MyEvent, LboxCombobox LCombo, int x, int y ) {
LCombo.setLocation(BasePosition+x,(BaseLine+y)*RowPitch+5);
Client.add( LCombo );
LCombo.addActionListener(MyEvent);
}
// メニュー実装
public void CreateMenu() {
setJMenuBar( MenuBar );
}
// ポップアップメニュー実装
public void AddMenu(LboxMenu Popup) {
MenuBar.add( Popup );
}
// メニュー項目実装
public void AddMenu(ActionListener MyEvent, LboxMenu Popup, LboxMenuItem Item) {
Popup.add( Item );
Item.addActionListener(MyEvent);
}
// 単純確認メッセージボックス
public void MsgOk(String Message) {
JOptionPane.showMessageDialog(this,Message);
}
}
| |
|
|
|