Put an 'X' in the corner of a JPanel, what's the trick?
I've seen applications (I assume written in java) where there is an 'X' to dispose() of a panel or toolbar.
Here I've done a quick and dirty mock up of my application. If someone could oblige with a line or 2 showing how to do this, or even a link to the API /forum thread (that I've already searched) - much will be appreciated. Also please bear in mind that I need to keep clear of the 1.4 API 'cos of backward compatability issues, taa.import java.awt.*;
import javax.swing.*;
public class justjunk{
public static void main(String []args){
new justjunk();
justjunk(){
JFrame frame = new JFrame("demo only");
JPanel north = new JPanel();
north.add(new JLabel("some text label"));
north.add(new JButton("A button"));
north.add(new JButton("nuther button"));
* I want to set an 'X' at the top right hand corner of JPanel
* west, so that it can be closed at the discretion of the user,
JPanel west = new JPanel();
west.setPreferredSize( new Dimension( 100, (frame.getHeight()-north.getHeight()) ) );
west.setLayout(new FlowLayout(FlowLayout.CENTER));
west.setBorder(BorderFactory.createTitledBorder(" My Toolset : "));
JButton []button = new JButton[8];
for(int i=0; i<button.length; i++){
button[i] = new JButton("button "+(i+1));
west.add(button);
frame.getContentPane().add(north, BorderLayout.NORTH);
frame.getContentPane().add(west, BorderLayout.WEST);
frame.getContentPane().add(new JTextArea(), BorderLayout.CENTER);
frame.setSize(400, 400);
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible(true);
Here's a suggestion
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class XMarksTheSpot {
public static void main(String []args){
new XMarksTheSpot();
XMarksTheSpot() {
final JFrame frame = new JFrame("demo only");
frame.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
final JPanel north = new JPanel();
north.add(new JLabel("some text label"));
north.add(new JButton("A button"));
north.add(new JButton("nuther button"));
JLabel x = getXLabel();
x.addMouseListener(new MouseAdapter()
public void mousePressed(MouseEvent e)
north.setVisible(false);
north.add(x);
* I want to set an 'X' at the top right hand corner of JPanel
* west, so that it can be closed at the discretion of the user,
final JPanel west = new JPanel();
west.setPreferredSize( new Dimension( 100, (frame.getHeight() -
north.getHeight()) ) );
west.setLayout(new FlowLayout(FlowLayout.CENTER));
west.setBorder(BorderFactory.createTitledBorder(" My Toolset : "));
x = getXLabel();
x.addMouseListener(new MouseAdapter()
public void mousePressed(MouseEvent e)
frame.remove(west);
frame.validate();
frame.repaint();
west.add(x);
JButton []button = new JButton[8];
for(int i=0; i<button.length; i++) {
button[i] = new JButton("button "+(i+1));
west.add(button);
frame.getContentPane().add(north, BorderLayout.NORTH);
frame.getContentPane().add(west, BorderLayout.WEST);
frame.getContentPane().add(new JTextArea(), BorderLayout.CENTER);
frame.setSize(400, 400);
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible(true);
private JLabel getXLabel()
JLabel label = new JLabel("X", JLabel.RIGHT);
label.setPreferredSize(new Dimension(45, 25));
//label.setBorder(BorderFactory.createEtchedBorder());
label.setFont(new Font("ludida bright demibold", Font.PLAIN, 24));
label.setForeground(Color.red);
return label;
Similar Messages
-
in the new Pages 5.0, what is the page break shortcut key (it used to be the Fn + enter). I cannot find the (new) key as indicated on the drop down menu. Please help.
Hi Bruce and fruhulda,
ok, I found the keyboard viewer, it only shows the traditional symbol 'return'. something like a sideway u-turn continued with the arrow under. This is the Canadian or US keyboard.
btw thanks for your suggestion. -
When I turn on my iPad 1it stops the network connection to my windows xp pro computer. Ican fix the network connection by repairing the windows machine network. What is the reason this is happening?windows
Are you using DHCP to allocate IP addresses via your router or Static IP allocation?
You may have an IP conflict in your network.
Check on your various network configuration parameters in your iPad, PC and WiFi router. -
Firefox will not access the internet. I have used Firefox for years and the past week I have not been able to get on the internet??? What is the problem. My interent works as I get email and can iuse Internet Explorer to access
Which version of Firefox are you using?
See
* https://support.mozilla.com/en-US/kb/Firefox%20cannot%20load%20websites%20but%20other%20programs%20can -
I recently upgraded to Mac OS X. I haven't tried to access anything in iWorks 09 since the upgrade, until now. I get an error message when trying to open any of the iWorks 09 applications. What's the fix for this?
Follow Sonicray's advice and when you post try to give as much info about your Mac, your OS, etc... Fill out your Profile info.
-
while using g mail i am unable to open my inbox mail and i can't give reply (compose mail is not working)because of these problem i m not able to use my mail properly so how can i resolve the problem???what is the correct solution ??
Hello,
First try to clear the cache and the cookies from sites that cause problems.
"Clear the Cache":
* Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
"Remove Cookies" from sites causing problems:
* Firefox/Tools > Options > Privacy > Cookies: "Show Cookies"
If that doesn't help then please can you test in Firefox's safe mode to see if the problem still occurs?
[[Troubleshoot Firefox issues using Safe Mode]]
If the problem doesn't occur in Safe Mode then continue to follow the instructions to find the setting or add-on that is causing the problem.
If the problem does occur in Safe Mode then I suggest doing a Firefox Reset. This will return Firefox to default settings. Your bookmarks, history etc will be saved but you will need to reinstall your addons.
I hope this helps. Let me know! -
Hi,I have problem with my mac's storage. I deleted some documents,but the storage involves 34Gb other,what does the other consist of? how can I do my mac's storage specially other free?
1. Empty Trash.
http://support.apple.com/kb/PH10677
2. Delete "Recovered Messages", if any.
Hold the option key down and click "Go" menu in the Finder menu bar.
Select "Library" from the dropdown.
Library > Mail > V2 > Mailboxes
Delete "Recovered Messages", if any.
Empty Trash. Restart.
3. Repair Disk
Steps 1 through 7
http://support.apple.com/kb/PH5836
4. Disk space / Time Machine ?/ Local Snapshots
http://support.apple.com/kb/ht4878
5. Re-index Macintosh HD
System Preferences > Spotlight > Privacy
http://support.apple.com/kb/ht2409 -
For the cm with multiple bps, what are the options for workaround?
For the cm with multiple bps, what are the options for workaround?
customer a purchases 1000
and returns 800 at POS
customer b was used at SAP related to this transaction, purchase amounting to 2000,what can we do to apply the returns of customer a to customer b of 800 return transaction at pos?customer a and customer b code pertains to just one client---but were given different codes at POS and at SAPHi,
If one customer has two codes, you can only do manual journal entry to adjust their accounts.
Thanks,
Gordon -
Keynote is not responding. I have already worked on my slides for hours, but did not save; suddenly the application stops responding. What's the solution?
If you had never saved the file at any time, you have lost your work.
Go to; Apple Menu > Force Quit
Start a new presentation, and from now on, after adding the first object to the slide, save the file. -
I am unable to sync and transfer purchased items to my computer as i am unable to open the the transfer tab (it is white instead of the usaul black writing). What is the problem ? (The itunes is authorised for my computer.)
If this is a new computer you need to authorise it. In itunes click on STORE and hten authorise this computer.
After this if you cannot find your phone read these articles
Phone not recognised in itunes
device not recognised by iTunes on PC or device not recognised by iTunes on Mac -
What r the different versions in sap & what r the new tools
dear all good morning?
what r the different versions in sap & what r the new tools introduced in the market regarding sap-abap.
thanks,
jyothi.Hi Jyothi,
Refer this link for ECC 5.0 & 6.0:
http://help.sap.com/saphelp_erp2005/helpdata/en/43/68805bb88f297ee10000000a422035/frameset.htm
A similar post
/message/1783778#1783778 [original link is broken]
You can go through the Release Notes for each of the versions after 4.6B (4.6C, 4.7 , ECC 5.0 & ECC 6.0)
http://help.sap.com/saphelp_erp2005/helpdata/en/43/688055b88f297ee10000000a422035/content.htm
For 4.7 SAP R/3 http://help.sap.com/saphelp_47x200/helpdata/en/12/9d78d6d8f74043a32e82be87e433b7/content.htm
Release Notes on SAP Web Application Server 6.30
http://help.sap.com/saphelp_47x200/helpdata/en/2b/64fc3e9d3b6927e10000000a114084/content.htm
http://solutionbrowser.erp.sap.fmpmedia.com/
Check these links
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/790e690c-0901-0010-7894-de8b3d91d78e
http://help.sap.com/saphelp_nw04/helpdata/en/94/c65839bec58b27e10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/a8/b9623c44696069e10000000a11405a/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/c1/1253164e665b4fa635af38b66dc166/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/f5/a9673e42613f7ce10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/dc/6b7f2f43d711d1893e0000e8323c4f/frameset.htm
Regards,
Sana.............
Reward Points if found helpful! -
What is the use of AET? What are the differences between AET and EEWB?
Hi,
I would like to know about AET? What is the use of AET? What are the differences between AET and EEWB? Please help me out?
Thanks,
SatishHi
You can refer the following links for your question.
Difference between AET and EEWB
What is the use of AET? What are the differences between AET and EEWB?
Difference between EEWB - UI Configuration Tool - AET
http://senthilsapcrm.wordpress.com/2010/02/04/adding-custom-fields-in-sap-crm-7-0-using-aet/
What is the main difference between eewb and aet tool ?
Hope it is useful.
Thanks and regards
Preeti Viswanath -
Hi, I'm trying to shut down the phone in the normal way (the Sleep / Wake button and hold down on the Close tab) turns off the display after a while yet, but the phone turns off completely opens up the phone to come out after the apple logo .. What is the reason I'd appreciate if you help how to fix it ...pleasa help me
Doing those doesn't turn off your phone?
As stated hold down the top button only until you see the red slider to power off your phone.
If that doesn't work then take it to Apple and see what they say. -
I have imported videos to my lap top (Windows Vista), from my new ipad. QuickT
ime plays them with audio, however the screen is black. What is the fix?Experimental advice (in this particular context) coming up.
Open your QuickTime control panel (either via the Control panels, or by going "Edit > Preferences > QuickTime Preferences" in the Quicktime Player). In the Advanced tab, uncheck Enable Direct3D video acceleration:
... and click OK. Quit and restart the QuickTime Player prior to checking to see if the settings change has had any effect. -
I need to record two camera interview shoots and turn the video around quickly. What is the best solution using a MacBook Pro and final cut pro?
Try reimporting all your media: file>>import>>reimport>>continue
Maybe you are looking for
-
Merge Replication Error When Initialising subscription
I have a SQL server 2005 server with a merge publication of 6 articles all of which are tables which is also the distributor. I have two existing subscriptions one from a SQL 2005 Server and one from a SQL Server 2008 R2 Server both of which are work
-
Delete only one file from Trash
Hello There, I do not want to empty my entire Trash folder but only some files which i know I am not going to use it. Is there a way to delete only selected files and not just empty trash... Thanks in advance for the help.. NA
-
How to remove my credit card information from my apple I'd?
Guys, I received the receipt of a wrong transaction that I didn't initiate on I tunes. I need to either remove my credit card information completely, so that every time I buy anything I'll put it manually. Please provide a solution. Thanks Ashish
-
Error message and bbm failure.
Blackberry Curve 8520, OS5, carrier Orange. Three problems: 1. When I turn on the phone I get an error message: "You are attemptin g to open a secure connection but the senders certificate is not trusted" Options are "Continue", "Close connection",
-
When backing up catalog it loops after about 70%-PS7
Hi I am trying to do by first backup of the catalog of about 3000 files.To external drive Always, after about 70% it ends up in a loop with "Program not responding" shown in Task manager. I have checked that the catalog does not need repairing