@634

簡易テキストエディタ その2 ウィンドウづくり

Advertisement

おもいっきり横道それた

前回のヤツ、見た目かっこわるいから変更。
ちょいちょいっとコード追加するだけだ。

Look & Feel

import javax.swing.*;

public class SwingTest{
    public static void main(String args[]){

        //Look&Feel
        JFrame.setDefaultLookAndFeelDecorated(true);
        try{
            javax.swing.plaf.metal.
            MetalLookAndFeel.setCurrentTheme(
            new javax.swing.plaf.metal.DefaultMetalTheme());

            UIManager.setLookAndFeel(
                "javax.swing.plaf.metal.MetalLookAndFeel");
        }catch(Exception e){
            System.out.println(e);
            System.exit(0);
        }

        MyFrame mf = new MyFrame();
        mf.setTitle("簡易テキストエディタ");
        mf.setSize(400, 300);
        mf.show();
    }
}

class MyFrame extends JFrame{
    public MyFrame(){
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
}
見た目のみ重視だからエラー処理とか適当だぁ。
完成図
実行イメージ
おおお、かっこいー。

Advertisement

ショートカット

634
634ブログ
このカテゴリのトップページに戻る
Incubator(Pukiwiki)
634ラボ
   UIコレクションギャラリー
   ZO-3ジェネレーター

サイト検索


Y!ログール