2012-04-30 7 views
1

は、私はこのようなGUIを持っている必要があります:Javaでブロックダイアグラムを描画するには?

Block Diagram

ここですべての矩形ボタンでなければなりません。どうすればこれを達成できますか?私にJFormDesignerのようなツールを提案してください。

+0

を求めていますか?または、ボックスがJButtonであるGUIレイアウトを作成する方法を尋ねていますか? –

+0

ボックスがJButtonであるGUIレイアウトを作成する方法について質問しています。 – svkvvenky

+0

ボタンを四角形で描画したいのですか?[this](http://cl.ly/3Y1X2l301z383e0f231V)のようなものを探していますか? – Paaske

答えて

2

私はJGraphで多くの良い経験をしています!

ドキュメントを参照してください、あなたが図にhere

各ノードを実現することができるもののいくつかの例をクリックすることができ、イベントがために聞くことができ、ちょうどボタンのように、作用。実際には、JButtonを図のノードに入れることはできますが、間違っている可能性があります。

編集:ただ、通常のJava Swingコードを使用してレイアウトがこの

import java.awt.BorderLayout; 
import java.awt.Container; 

import javax.swing.JButton; 
import javax.swing.JFrame; 
import javax.swing.JPanel; 

public class LayoutTest { 

    public static void main(String[] args) { 

     JFrame window = new JFrame(); 
     Container container = window.getContentPane(); 
     container.setLayout(new BorderLayout()); 

     JPanel centerPanel = new JPanel(); 
     centerPanel.add(new JButton("Center")); 
     container.add(centerPanel, BorderLayout.CENTER); 

     JPanel topPanel = new JPanel(); 
     topPanel.add(new JButton("b1")); 
     container.add(topPanel, BorderLayout.NORTH); 

     JPanel rightPanel = new JPanel(); 
     rightPanel.add(new JButton("b3")); 
     container.add(rightPanel, BorderLayout.EAST); 

     JPanel bottomPanel = new JPanel(); 
     bottomPanel.setLayout(new BorderLayout()); 

     JPanel bottomNorthPanel = new JPanel(); 
     bottomNorthPanel.add(new JButton("b2")); 
     bottomPanel.add(bottomNorthPanel, BorderLayout.NORTH); 

     JPanel bottomSouthPanel = new JPanel(); 
     bottomSouthPanel.add(new JButton("b2-1")); 
     bottomSouthPanel.add(new JButton("b2-2")); 

     bottomPanel.add(bottomSouthPanel, BorderLayout.SOUTH); 

     container.add(bottomPanel, BorderLayout.SOUTH); 

     window.setSize(320, 240); 
     window.setVisible(true); 

    } 
} 
0

ようなものになるだろう、私は、JavaのSwingの上のものを求めているとします。 drawLine()とdrawRect()を使うことができます。コンポーネントをペイントすることをコントロールしなければなりません。これをよく理解し、必要に応じた基本クラスを作成すれば、本当にうまくやることができます。
詳細については、「スイングの初心者向けガイド」のSchildtの例を参照してください。 listing- http://www.mhprofessional.com/getpage.php?c=computing_downloads.php&cat=112についてはページ495 上(下に行く)

・ホープ、このことができます..あなたはJavaで*ペイント*図にどのよう

関連する問題