开发者

adding jpanel into a jframe. netbeans

i am particularly using netbeans gui editor and i am new to gui

i have a jframe created and I added jtabbedpanel.

inside the jtabbedpanel i have 2 panels that i call standard and compact

i have set standardPanel = new ImagePa开发者_Python百科nel(); which ImagePanel.java is located on different java file

how am I suppose to put a panel on different file for reusability ?

i obviously dont want all the codes in a single file.

is this the right way to design a gui ?

thanks


You should create your own class, something like "CustomPanel" that extends from JPanel. You put that class in its own file, and everything that goes on the JPanel should be a part of that class.

Then, instead of adding a JPanel to the tabbed panel, you create an instance of CustomPanel and add it to the tabbed panel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜