Creating multiple panels in one frame
Greetings,
As a newbie, I am sure you all have been in my place at one time or another so I will skip right to the meat of what I am trying to do.
I originally started out with GridBagLayout() and placing all my code in the main function declaration but that has it's limits.
I am trying to find a way to mount / add multiple panes onto one JPanel using functions in order to break up the code. I don't get an error when I compile, but the screen appears blank which tells me that I am adding one JPanel onto another in the wrong manner.
class PanelTest extends JFrame
private JPanel mainPanel;
private JPanel headerPanel;
public void PanelTest()
mainPanel = new JPanel(new BorderLayout());
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setPreferredSize(new Dimension(400, 100));
mainPanel.add(topPanel(), BorderLayout.NORTH);
getContentPane().add(topPanel());
private JPanel topPanel()
headerPanel = new JPanel ();
headerPanel.setPreferredSize(new Dimension (300, 50));
headerPanel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder("Header Image"),
BorderFactory.createEmptyBorder(5,5,5,5)));
JLabel text = new JLabel("TEST");
headerPanel.add(text);
return headerPanel;
}I then use the following code in my main file to call and execute the code
class BerylMain extends JFrame
public static void main(String args[])
PanelTest panelTest = new PanelTest();
panelTest.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
panelTest.setSize(500, 400);
panelTest.setVisible(true);
}I appreciate any advise on this.
public void PanelTest() {
/* try commenting this.
mainPanel = new JPanel(new BorderLayout());
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setPreferredSize(new Dimension(400, 100));
mainPanel.add(topPanel(), BorderLayout.NORTH);
getContentPane().add(topPanel());
}
Similar Messages
-
Hi all,
I'd like to know how to be able to display multiple screens within one frame. Depending on the choice made on the first screen, the second screen should be either "View Default" or "Modify Default." The modifying will involve a number of other screens.
One idea is to group by Panel and control panels. Any better idea?
Regards,
OmerDo you mean multiple displays in one frame? If so, you have several options. With JTabbedPane you could dynamically add new views to the frame, with the disadvantage of only being able to see one at a time. JSplitPane allows you to nest various views within one frame, though has the disadvantage of having extremely complex display logic when several split panes are displayed at the same time, and of displaying all displayed panes simultaneously.
Perhaps the best possibility is to use JDesktopPane, within which you can insert as many JInternalFrames as you want. -
Creating multiple JFrames in one program
What kind of trouble should I look for when creating multiple JFrames in one application. These JFrames will talk to each other via drag and drop. Is this ok?
What kind of trouble would you like? I'm sure you can engineer all kinds. As long as you have a place to hold the frame references, you should be okay. If you need them.
You can do drag and drop between components in different frames, no problem. Better read up on drag and drop first though. -
Display 3 Panels in one frame.....
Hi
I need to display 3 different panels in one frame.
The first panel will contain a JXTreeTable [North]
The second Panel will contain a Tree [Center]
The third Panel will contain a JXTreeTable [South]
I am unable to get this working as the components to be displayed
are not being placed properly.
The JXTreeTable is being displayed only at the NORTH.
Is it better to create 3 different panels or create just one panel with GridLayout(as I have done)
Have I overlooked something in the code below?
Thnx
This is my code:
public class PositionCostingView {
public PositionCostingView(){
initComponents();
private void initComponents(){
final JFrame frame = new JFrame("Position Costing");
frame.setPreferredSize(new Dimension(450, 300));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// First,testing my model
TreeTableModel model = new OpTreeTableModel();
JXTreeTable treeTable = new JXTreeTable(model);
// Add the TreeTable to a Scroll Pane.
JScrollPane scrollPane = new JScrollPane(treeTable);
JPanel players = new JPanel(new GridLayout(3, 0));
players.add(scrollPane);
players.add(MyTree);
players.add(scrollPane);
JPanel content = new JPanel();
content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
content.add(players);
frame.getContentPane().add(content);
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
new PositionCostingView();
}Please ignore my code on top.I am trying something else.....
No offence meant please. -
Create multiple folders with one click on documents tab in BP in SAP CRM
Hi Experts,
I have a requirement to create multiple folders by clicking on a button in Documents tab in BP transaction in CRM. In standard process by clicking on create folder button we create folders. we want to create multiple folders with one single click ( i guess we can develop another button for that) folder name will be hard coded. Kindly let me know , how this can be achieved.Hi Experts,
I have a requirement to create multiple folders by clicking on a button in Documents tab in BP transaction in CRM. In standard process by clicking on create folder button we create folders. we want to create multiple folders with one single click ( i guess we can develop another button for that) folder name will be hard coded. Kindly let me know , how this can be achieved. -
Address Book - Create multiple contacts at one company?
I am using Address Book v 4.0.4 and I want to be able to create multiple contacts at one company without having to reenter the Company, Tel. and Address information each time.
Is there a way to duplicate an address, say the basic company address, to make the process of entering multiple people at one company any faster?
Any tips would be appreciated. Thanks, Michel
MBP Laptop & G5 Tower Mac OS X (10.4.9) Address Book v 4.0.4I talked to Apple today and here is how you create multiple contacts at one address, company etc. without having to reenter everything.
1) In Address Book, highlight a contact in the name list
2) Go to the Edit Menu & COPY
3) Go back to the Edit Menu & PASTE
4) Make changes to the new 'duplicated' contact
Seems easy if you know how to do it. -
HCM Processes and Forms - Create multiple records of one infotype (eg 0008)
Dear all,
I'm trying to create two new records in infotype 0008 (basic pay). Regarding it's time constraint 1 it should like the following:
Before
01.01.2010 - 31.12.9999 - 2000u20AC
After
01.01.2010 - 08.11.2010 - 2000u20AC
09.11.2010 - 31.12.2010 - 2500u20AC
01.01.2010 - 31.12.9999 - 3000u20AC
So I want to add two splits two the record. One is easy, as it's done by the SAP_PA operation. I experimented with the record indices and duplicating my fields, but it didn't work. Another idea would be to retriggerd the SAP_PA several times using scenario steps.
Can you give me a hint, by which lever multiplee splits can be achieved? Or is this not possible at all?
Thanks in advance,
PeterThanks for your fast reply.
Knowing this as a fallback is comforting. I just want to ensure, that I don't apply any coding, if a task is also possible by customizing.
Another idea I had in the meantime was to execute the SAP_PA several times. Do you have any experience, if this works to create multiple records in one infotype?
Edited by: Peter Gilberg on Nov 9, 2010 2:34 PM -
Creating multiple procedures in one go
When I try to create multiple procedures in one go
All of the procedures are stored in the first procedure
When I run the following script:
create or replace
PROCEDURE CREATE_ITEM
(ITEM_id items.item_id %type,
ITEM_DESC items.item_description %TYPE,
ITEM_COST items.item_cost %TYPE,
ITEM_QUAN items.item_quantity %TYPE)
AS
BEGIN
if (ITEM_QUAN >=0)
THEN
insert into items values
(upper(item_id) || LPAD(seq_item_id.nextval, 4, '0'), upper(ITEM_DESC), ITEM_COST, ITEM_QUAN);
DBMS_OUTPUT.PUT_LINE (ITEM_DESC || ' was recorded');
else
DBMS_OUTPUT.PUT_LINE ('Quantity should be 0 or more!!');
end if;
END CREATE_ITEM;
CREATE OR REPLACE PROCEDURE CREATE_ORDER
(customer_id customer.customer_id %TYPE)
AS
BEGIN
insert into orders values
(seq_order_id.nextval, 0, customer_id, sysdate, 1);
END CREATE_ORDER;
It creates "CREATE_ITEM" procedure and store all the script in it..
Is there a solution for this problem?
regardsHi
Place a forward slash
between the two procedures on its own line.
SQL*Plus requires it as well.
Regards,
Dermot.
SQL Developer Team -
Creating multiple links from one map image in Flash CS4
I have been tasked with creating multiple links from one map image using flash. Each link would go to the main website page with that location. I assume I could create a button for each location on the map but not having a lot of experience any help / tutorial you know of would be super helpful.. Thanks! Not looking for someone to work me thru it but a little guidance would be great!
If I was to answer the problem, I would be giving you what you asked not to be given... the solution. So I'll suggest that you start by researching the getURL() function. That is what AS2 uses for opening web pages.
As for coding a button, I'll recommend the following article for you... it will explain the proper approach to coding a button, which will give you an advantage over others who don't follow it, but instead use the way the article says not to.
http://www.adobe.com/devnet/flash/articles/as_bestpractices_04.html
Google is one of the best resources available for learning how to do things with Flash--it's the first place I go when I have a wondering. In general, if you type in the right keywords, you get fairly good search results. In your case, combinations of "AS2", "button", "getURL", "tutorial" would probably work well. -
Getting multiple panels in one extension
Hi,
I'm having trouble setting up multiple panels in my extension. I've seen similar posts on here but what fixed it for them doesn't seem to solve it for me!
My first panel appears fine, but clicking the menu option for the second one does nothing.
I have a WidgetBoss for each:
Class
kPanelAWidgetBoss,
kPalettePanelWidgetBoss,
IID_IPANELMENUDATA, kCPanelMenuDataImpl,
Class
kPanelBWidgetBoss,
kPalettePanelWidgetBoss,
IID_IPANELMENUDATA, kCPanelMenuDataImpl,
ALocaleIndex for each:
resource LocaleIndex (kPanelAResourceID)
kViewRsrcType,
kWildFS, k_Wild, kPanelAResourceID + index_enUS
resource LocaleIndex (kPanelBResourceID)
kViewRsrcType,
kWildFS, k_Wild, kPanelBResourceID + index_enUS
A separate PanelList for each:
resource PanelList (kPanelAResourceID)
// 1st panel in the list
kPanelAResourceID,
kPluginID,
kNotResizable,
kPanelAWidgetActionID,
kPanelAMenuPath,
kPanelAMenuItemPosition,
0,0,
c_Panel,
resource PanelList (kPanelBResourceID)
// 2nd panel in the list
kPanelBResourceID,
kPluginID,
kNotResizable,
kPanelBWidgetActionID,
kPanelBMenuPath,
kPanelBMenuItemPosition,
0,0,
c_Panel
A type definition:
type PanelAWidget(kViewRsrcType) : PalettePanelWidget(ClassID = kPanelAWidgetBoss)
CPanelMenuData;
type PanelBWidget(kViewRsrcType) : PalettePanelWidget(ClassID = kPanelBWidgetBoss)
CPanelMenuData;
And a definition for the resource itself:
resource PanelAWidget(kPanelAResourceID + index_enUS)
__FILE__, __LINE__, // Localization macro
kPanelAWidgetID, // WidgetID
kPMRsrcID_None, // RsrcID
kBindNone, // Binding (0=none)
0, 0, 207, 95, // Frame: left, top, right, bottom.
kTrue, kTrue, // Visible, Enabled
kFalse, // Erase background
kInterfacePaletteFill, // Erase to color
kFalse, // Draw dropshadow
kPanelATitleKey, // Panel name
kInternalPopupMenuNameKey // Popup menu name (internal)
resource PanelBWidget(kPanelBResourceID + index_enUS)
__FILE__, __LINE__, // Localization macro
kPanelBWidgetID, // WidgetID
kPMRsrcID_None, // RsrcID
kBindNone, // Binding (0=none)
0, 0, 207, 95, // Frame: left, top, right, bottom.
kTrue, kTrue, // Visible, Enabled
kFalse, // Erase background
kInterfacePaletteFill, // Erase to color
kFalse, // Draw dropshadow
kPanelBTitleKey, // Panel name
kInternalPopupMenuNameKey // Popup menu name (internal)
PanelB is nowhere to be seen.
I guess I'm missing something obvious. Can anyone help?
Thanks
LizHi
I just copied that into my plugin and it seems to be correct.
Bellow you can find change log from my plugins.
Regards
Bartek
1. Claas definitions
Class { kPanelAWidgetBoss, kPalettePanelWidgetBoss,
{ IID_IPANELMENUDATA, kCPanelMenuDataImpl, }},
Class { kPanelBWidgetBoss, kPalettePanelWidgetBoss,
{ IID_IPANELMENUDATA, kCPanelMenuDataImpl, }},
2. PanelList definitions:
resource PanelList (kPanelAResourceID)
// 1st panel in the list
kPanelAResourceID,
kMYUIPluginID,
kNotResizable,
kPanelAWidgetActionID,
"AAA",
kPanelAMenuPath,
kPanelAMenuItemPosition,
0,0,
c_Panel,
resource PanelList (kPanelBResourceID)
// 2nd panel in the list
kPanelBResourceID,
kMYUIPluginID,
kNotResizable,
kPanelBWidgetActionID,
"BBB",
kPanelBMenuPath,
kPanelBMenuItemPosition,
0,0,
c_Panel
3. Layout definitions
resource PanelAWidget(kPanelAResourceID + index_enUS)
__FILE__, __LINE__, // Localization macro
kPanelAWidgetID, // WidgetID
kPMRsrcID_None, // RsrcID
kBindNone, // Binding (0=none)
0, 0, 207, 95, // Frame: left, top, right, bottom.
kTrue, kTrue, // Visible, Enabled
kFalse, // Erase background
kInterfacePaletteFill, // Erase to color
kFalse, // Draw dropshadow
kPanelATitleKey, // Panel name
kMYUIInternalPopupMenuNameKey // Popup menu name (internal)
resource PanelBWidget(kPanelBResourceID + index_enUS)
__FILE__, __LINE__, // Localization macro
kPanelBWidgetID, // WidgetID
kPMRsrcID_None, // RsrcID
kBindNone, // Binding (0=none)
0, 0, 207, 95, // Frame: left, top, right, bottom.
kTrue, kTrue, // Visible, Enabled
kFalse, // Erase background
kInterfacePaletteFill, // Erase to color
kFalse, // Draw dropshadow
kPanelBTitleKey, // Panel name
kMYUIInternalPopupMenuNameKey // Popup menu name (internal)
4. Locale definitions
resource StringTable (350 + index_enUS) // No-Translate strings go here:
{ k_enUS, kEuropeanMacToWinEncodingConverter, // Locale Id, Character encoding converter
{ kMYUIInternalPopupMenuNameKey, kMYUIInternalPopupMenuNameKey,
resource LocaleIndex (kPanelAResourceID)
{ kViewRsrcType,
{ kWildFS, k_Wild, kPanelAResourceID + index_enUS
resource LocaleIndex (kPanelBResourceID)
{ kViewRsrcType,
{ kWildFS, k_Wild, kPanelBResourceID + index_enUS
5. Type definitions:
type PanelAWidget(kViewRsrcType) : PalettePanelWidget(ClassID = kPanelAWidgetBoss)
CPanelMenuData;
type PanelBWidget(kViewRsrcType) : PalettePanelWidget(ClassID = kPanelBWidgetBoss)
CPanelMenuData;
6. Other definitions:
// Boss classes:
DECLARE_PMID(kClassIDSpace, kPanelAWidgetBoss, kMYUIPrefix + 7 )
DECLARE_PMID(kClassIDSpace, kPanelBWidgetBoss, kMYUIPrefix + 8 )
// Action IDs:
DECLARE_PMID(kActionIDSpace, kPanelAWidgetActionID, kMYUIPrefix + 12)
DECLARE_PMID(kActionIDSpace, kPanelBWidgetActionID, kMYUIPrefix + 13)
// Widget IDs:
DECLARE_PMID(kWidgetIDSpace, kPanelAWidgetID, kMYUIPrefix + 10)
DECLARE_PMID(kWidgetIDSpace, kPanelBWidgetID, kMYUIPrefix + 11)
#define kPanelAMenuPath ""
#define kPanelBMenuPath ""
#define kPanelAMenuItemPosition 0.0
#define kPanelBMenuItemPosition 0.0
#define kPanelATitleKey "AAA"
#define kPanelBTitleKey "BBB"
const RsrcID kPanelAResourceID = 700 + 50;
const RsrcID kPanelBResourceID = 700 + 51; -
Bash script question, how do I create multiple directories on one line
I am making a package for amavisd-new (yes I am aware that there is one in community but I can't say I like the way it is done).
I have an install script from which I want to create multiple directories if they do not exist.
So I want to create a directory /var/spool/amavis with subdirectories of var tmp virusmails spammassassin .
I can't seem to be able to find a way to do this on one line.pelle.k wrote:
peets wrote:Hehe because it's less typing!
Good one!
Also, it's by far the more dynamic method.
If you want to get pedantic, it's also far less efficient in terms of execution time: each iteration of the loop forks a new process, whereas using a single mkdir command forks only once. The "best" way is the curly-braces method demonstrated above by chimeric. -
Creating Multiple trendlines on one graph
I'm showing a density relationship and not all of the weights or ml's are the same. Is there a way I can graph this? Or is there a really good tutorial somewhere? I've been searching but maybe I'm not using the right words.
ex.
zinc, 3.1g/.5ml 2.6g/.41ml etc.... I know how to get a get a line for that but if I want to add
copper 4.6g/.60 ml, 2.9g/.39ml... etc to the same graph, how will I keep them separate? I'm unable to create multiple trend lines on the same graph.
thanksYou need to plot two series of data to have two trendlines. It would make sense to have two series anyway because you have two different materials.
Zinc X values (ml?) in column B
Zinc Y values (g?) in column C
Copper X values (ml?) in column D
Copper Y values (g?) in column E
Select all four columns, create a scatter chart. Create trendlines for each series.
If you already have the two columns for Zinc, just add the columns for copper and add them to the chart. Select the chart and you'll get a box around your data. Drag the little circle in the lower right to expand the box to cover your two new columns.
You can also make the same chart with only three columns (one X and two Y) but it's a little more difficult. -
Creating multiple source systems one logical system
Hi,
The requirement is to create two source systems using same logical name and different RFC connections to ECC?
We wanted to do some regular activities using one source system and some drill down activities using different source system.
I am getting error when I try to create second source system "source system already exist"
Please advice.
Thanks.Hi,
I dont think it is possible to create multiple source systems in a sinle logical client. You have to create multiple clients and you can connect to BI system by different RFCs.
Hope this helps.....
Regards,
Suman -
Misspelled Artist Names Create Multiple Artists from One
What to do if Spotify has misspelled an artist's name and created two artist of one. I have seen many exemples. The Last one is Garnett Silk (right) and Garnet Silk (wrong, it shall be 2 tt). The result is that Spotify has one list with Garnett and another song list with Garnet. The songs are 80% the same and 20% unique for Garnett or Garnet. There are more such misspellings, in some cases one artist or band can become three or four. More common is that many songs are created because of misspellings of a song title. Spotify should be more professional than this. Or is it only a big computer running and making the artist presentations and album and song lists? Where can I inform Spotify about such errors? Best Regards Sanmare
I'm not sure I understand from your post what it is that you want to see. You talk about what you do NOT want to see. Do you use an ID3 tag utility to make changes to your list of artists? My personal choice is ID3-TagIt (but there are dozens of other equally capable programs out there). With it, you can modify album names ... enter single or multiple artists ... and even add the composer, song lyrics, etc. However, just having those in the ID3 tag doesn't mean they will be displayed by all software programs (players) ... that's up to the person who writes the application. So even if you do put them in, your player might not display them how you'd like them to be displayed.
I know this doesn't specifically answer your question, but maybe you can rephrase it so we know what it is you want to see on your player's screen when you have multiple artists.
-Roger -
Create multiple delivery with one invoice
Hi all,
can you tell me how to do multiple delivery with one invoice,
i tried in vf01 by giving their my 3 delivery nos but it is generating three invoices
pls explain this in details
points will be rewarded
regards,
smmmmmmDear Sameer
As per your requirement run the Tcode VF04 (Billing Due list) and select the Delivery Documents for which you want to to have single Billing Document by clicking on Collective Billing document/Online Push Button in that screen.
To Have Single Billing Document for Multiple Delivery you need to have Payer,Terms of Payment,Incoterms(part 1 and part2) same for all materials orelse the billing document will split and this split analysis is visible during creating of Billing document.
Hope this will help you in solving your problem.
Regards
PSH
Maybe you are looking for
-
i have a line drawing (black on white paper) i have scanned and need to make the white paper transparent, maintaining the line drawing, can i and then HOW can i do this in PS? this is for my business logo. ive used it for years but with a solid backg
-
Hi. I purchased a new ipad mini and my brother already has iphone 4,so how can i avoid sharing the same contents that are on his phone? Will creating an other apple id help us in seperating our facetime and icloud accounts as we share our laptop to s
-
Replication Error between DC and PDC after a reboot.
Hi, We have a very small server environment and having one DC and one ADC. Last week ADC got a sudden restart. After booting it shown one service failed error. Since then the ADC is not replicating with DC. Giving below the diagnosis results of
-
Having problems with my Broadband and BT will not ...
Hi For the last TWO years I have had problems with my broadband. The problem is that my hub keeps re-synic it self. Yes I know that this supposed to happen but surly not up to 10 times a day, (some times 6 times in one hour) Every Day. I have no exte
-
iphone 4 on verizon(16 gb) ios 4.2.1 tried to restore and update but got error code after download.... all the iphone does is sit there with the picture to connect to itunes. This is very important, please help!!!!!! updated itunes and restarted and