public class TestFrame {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
JMenu menu = new JMenu("foo");
menuBar.add(menu);
JMenuItem item = new JMenuItem("bar");
menu.add(item);
frame.setSize(640, 480);
frame.setVisible(true);
}
}
Javaのソフト (スコア:1)
Javaで書かれたOS Xで使うソフト(しかも他のプラットホームでも動く物)
ってまだまだ少なくありませんか?
個人的な印象では、OS XのJavaのAquaの部品って、ボタンはでぶっち、
フォントは大きく、文字の下が間延びしていて、メニューは変な所に
あった
Re:Javaのソフト (スコア:2, 参考になる)
>>フォントは大きく、文字の下が間延びしていて、メニューは変な所に
>>あったり、Mac的な標準から外れているので、積極的には使いたいと思え
>>ないのですが・・・。
それは「OSXのJava環境だから」ではありませんよ。
ボタンの大きさ、メニューの配置等を決め
Re:Javaのソフト (スコア:0)
Windowsのようにメインウィンドウ内にあるのって
作者側の問題だったんですね。
Re:Javaのソフト (スコア:1)
Re:Javaのソフト (スコア:2, 参考になる)
一応サンプルコードと実行方法だけのせておきます。
import javax.swing.*;
public class TestFrame {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
JMenu menu = new JMenu("foo");
menuBar.add(menu);
JMenuItem item = new JMenuItem("bar");
menu.add(item);
frame.setSize(640, 480);
frame.setVisible(true);
}
}
ターミナルから実行:
$ javac TestFrame.java
$ java -Dapple.laf.useScreenMenuBar=true TestFrame