JTable have no resize cursor under a JLayeredPane
Hi,
i have over my JScrollPane a JLayeredPane to show infotext.
When the JLayeredPane is over the JScrollpane you can resize the column but the JTable show no resize Cursor.
Does anybody know why?
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
public class NoResizeCursorDemo extends JFrame
public NoResizeCursorDemo()
JTable table = new JTable( new DefaultTableModel( new String[]{ "aaa", "bbb" }, 10 ) );
JScrollPane scrollPane = new JScrollPane( table );
InfoLayer layer = new InfoLayer( scrollPane );
add( layer );
public static void main( String[] args )
NoResizeCursorDemo frame = new NoResizeCursorDemo();
frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
frame.pack();
frame.setVisible( true );
class InfoLayer extends JLayeredPane
private final JComponent wrappedComponent;
public InfoLayer( JComponent wrappedComponent )
this.wrappedComponent = wrappedComponent;
setLayout( null );
add( wrappedComponent, JLayeredPane.DEFAULT_LAYER );
setInfoText();
private void setInfoText()
add( new JLabel( "Info......" ), JLayeredPane.POPUP_LAYER );
revalidate();
@Override
public Dimension getPreferredSize()
return wrappedComponent.getPreferredSize();
@Override
public void doLayout()
Dimension size = getSize();
Component layers[] = getComponents();
for ( Component layer : layers )
layer.setBounds( 0, 0, size.width, size.height );
}Thanks
Hi,
I had almost the same problem with JTable and JSplitPane, the components worked fine, but cursor did not change when require.
I already had in place mouse events dispatching in my top layer. It passed all events to the components underneath (see example in [Glass Pane Demo Project|http://java.sun.com/docs/books/tutorial/uiswing/examples/components/GlassPaneDemoProject/src/components/GlassPaneDemo.java]; in my case the listener was the content panel of the top layer).
And now here is the trick around the cursor. Within the custom dispatch method I've called the following:
this.setCursor(comp.getCursor());
where "this" is the content panel of the layer and comp is the component where mouse event passed to.
Hope that helps!
Regards,
Sergey
Similar Messages
-
Resize cursor inconsistancy in JTableHeader
Hi all,
I have one table, it has 10 columns those are resizable and not reorderable. problem is when i move the mouse pointer between header area and the lines between the columns, the cursor is not
changing to resizable cursor. but for some tables this resizable cursor is appearing.
Can any body help me to solve this problem...
Thanks in advance...
Vijay...Hi Vijay,
Iam also facing the same problem.It seams it is the problem with JTable (JDK1.4), It is the problem in
Class:BasicTableHeaderUI
mehtod :mouseMoved().
Regards
shevron
Message was edited by: Shevron
shevron
Message was edited by:
shevron -
Resizing Components in a JLayeredPane
Hello,
I'm brand new to Java (formerly a VB man). I'm creating an application where icons are displayed on a background image and can be dragged around the window. The background image and the icons need to resize with the window.
I've managed to get the back ground image to resize but can't work out how to get the icon images to resize as well. I also need to keep their relative positions as well.
I have three classes which extend JFrame, JLayeredPane and JPanel to construct the display. I have attached them below.
If anyone can help or at least point me in the right direction I would be very grateful indeed.
Best regards
Simon
package imagelayers;
import java.awt.*;
import java.awt.color.*;
import java.awt.event.*;
import javax.swing.*;
public class SecondFrame extends JFrame
private JLayeredPane m_layeredPane;
private MovingImage m_movImage1, m_movImage2, m_movImage3;
private BackgroundImage m_background;
public SecondFrame() {
super("Moving Images");
setLocation(10,10);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Load the background image in a JPanel
ImageIcon kcIcon = new ImageIcon("images/kclogo.gif");
m_background = new BackgroundImage(kcIcon);
setSize(kcIcon.getIconWidth(), kcIcon.getIconHeight());
m_movImage1 = new MovingImage("images/dukewavered.gif", 0);
m_movImage2 = new MovingImage("images/dukewavegreen.gif", 1);
m_movImage3 = new MovingImage("images/dukewaveblue.gif", 2);
m_background.add(m_movImage1 , JLayeredPane.DRAG_LAYER);
m_background.add(m_movImage2 , JLayeredPane.DRAG_LAYER);
m_background.add(m_movImage3 , JLayeredPane.DRAG_LAYER);
m_movImage2.topLayer = 2;
Container contentPane = getContentPane();
contentPane.add(m_background);
setVisible(true);
public static void main(String[] arguments)
JFrame frameTwo = new SecondFrame();
package imagelayers;
import java.awt.*;
import javax.swing.*;
public class BackgroundImage extends JLayeredPane
private Image m_backgroundImage;
public BackgroundImage(ImageIcon bg)
m_backgroundImage = bg.getImage();
setBorder(BorderFactory.createTitledBorder(""));
public void paintComponent(Graphics g)
g.drawImage(m_backgroundImage,0,0,getWidth(),getHeight(),this);
package imagelayers;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import java.awt.*;
import java.awt.event.*;
public class MovingImage extends JLabel implements MouseListener, MouseMotionListener
private Image m_theImage;
private ImageIcon m_theImageIcon;
private int nStartX, nStartY;
static int topLayer;
public MovingImage(String imgLocation, int layerNum)
addMouseListener(this);
addMouseMotionListener(this);
m_theImageIcon = new ImageIcon(imgLocation);
m_theImage = m_theImageIcon.getImage();
setBounds(0, 0, m_theImageIcon.getIconWidth(), m_theImageIcon.getIconHeight());
public void paintComponent(Graphics g)
g.drawImage(m_theImage,0,0,getWidth(),getHeight(),this);
public void mousePressed(MouseEvent e)
JLayeredPane imagesPane = (JLayeredPane)getParent();
imagesPane.setLayer(this,topLayer,0);
nStartX = e.getX();
nStartY = e.getY();
public void mouseMoved(MouseEvent e){}
public void mouseClicked(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mouseDragged(MouseEvent e)
setLocation(getX() + e.getX() - nStartX, getY() + e.getY() - nStartY);
}Try useing the JFrames show() method or setVisible(true) method after you have added all the other components.
If that doesnt work use the JFrames validate() method, inherited from Container, after one of the previous methods.
Hope this helps -
Double arrow resize cursor of application frame extends over menu bar
Using Photoshop cs5 in application frame mode, when the cursor reaches any edge of the application frame it automatically turns into a double-arrow which when clicked and dragged will resize the application frame. (that is normal behavior). However, when the application frame is at the top of the screen against the menu bar, and then the cursor passes over the top edge of the application frame and onto the menu bar, that double arrow resizing cursor doesn't change back to the normal arrow cursor. Just very annoying to always see that double arrow when I'm trying to click any menu item on the menu bar.
I wonder if it's a photoshop issue or a mac issue, or if anyone else has noticed the same thing,
Working on a MacBook Pro 17" i7, 8gb ram in Photoshop CS5
Just tried doing the same thing in illustrator and it does not have that problem, everything works like it should - I move the cursor to the top and I don't even get that resize cursor at all (which is the way it should be since the top of the frame is against the menu bar there's no room to extend it upwards) so leads me to think it's a Photoshop issue.
Any feedback is appreciated.I can confirm that this happens on my machine as well.
Current work around is to click an empty spot on OS X menu bar to reset cursor to normal before selecting a menu item. I have seen this behaviour since initial release of PS CS5 (all updates installed and behaviour still exists).
Illustrator CS5 does not display this behaviour on my machine either, so it would appear to be confined to Photoshop (I am assuming the mouse-over parameters for resize may be to blame, or lack of recognition of menu bar proximity).
Machine specs:
Mac Pro (early 2008) - 2.8 Ghz. Quad-Core
OS X (10.6.4) - fully updated
8 GB RAM (1 GB / slot)
nVidia 8800 GT video adapter
ACD 23" display
Logitech LX8 mouse (no software installed for mouse, generic OS X driver)
Note - Wacom Intous3 drivers installed (haven't tested behaviour with tablet pen yet, but tablet only plugged in and used for specific painting, not during displayed behaviour).
Default install for PS CS5 and AI CS5.
Issue displayed with or without any third-party plug-ins installed.
A fix would be good. -
I use a macbook pro retina. I use a 32 in. monitor and use it full screen. I size the screen manually. Since i upgraded to maverick, I have to resize the screen each time I change windows.Before the upgrade the screen stayed where I put it.
Please read this whole message before doing anything.
This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, or by a peripheral device.
Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
Shut down your computer, wait 30 seconds, and then hold down the shift key while pressing the power button.
When you see the gray Apple logo, release the shift key.
If you are prompted to log in, type your password, and then hold down the shift key again as you click Log in.
*Note: If FileVault is enabled under OS X 10.7 or later, or if a firmware password is set, or if the boot volume is a software RAID, you can’t boot in safe mode. Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs. The next normal boot may also be somewhat slow.
The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test. -
If I have two undo tablespace, under what situation oracle will use another
if I have two undo tablespaces, under what situation oracle will use another
one is default undo tablespace, another is created manually
will it use it when the default one is full?
it seem like to be it won't use the second undo tablespace.
thanks
Edited by: user11402556 on Jul 3, 2010 2:18 PMYou can have two Undo Tablespaces created with the CREATE UNDO TABLESPACE syntax.
However, the current database instance will use the Undo Tablespace specified by the instance level parameter undo_tablespace.
When you want to switch the datafiles of an undo tablespace from, say, one mount point to another (or when you want to "resize" an undo tablespace that has grown very large for specific one-off / adhoc jobs), you would create another undo tablespace, reset the instance level parameter to the new undo tablespace and wait for a decent interval (e.g. at least undo_retention or autotuned undo retention) before dropping the old undo tablespace.
So yours is not a hypothetical question. Having two undo tablespaces is a real-world practice -- but the two are concurrently present for only a short duration, while transactions and queries switch from one to the other.
(In RAC, each database instance must have it's own Undo tablespace as well).
Hemant K Chitale -
Show resize cursor when mouse hovers edge of window?
When I'm not using the standard window chrome, is there an easy way to show the resize cursor when the mouse hovers a window edge?
thanks, that's the component I was looking for (assuming I can now change the fonts, colour etc)
I have done the following and it kind of works: it should highlight the text and show the tooltip. However, it kind of gets stuck every now and then...two things: it takes some time before the tooltip appears (1 sec): is there a way to make it immediate, simultanous to the highligh? also, I have a few Jtextfield, as you may remember..as I hover the mouse over each of them, it all works fine, but when I go back to a jtextfield previously hovered over and highlighted, nothing happens, until I randomly click around and then works again. Any ideas? thanks a lot
myJTextField.addMouseListener(new MouseAdapter(){
public void mouseEntered(MouseEvent e) {
((JTextField) e.getSource ()).requestFocus();
((JTextField) e.getSource ()).selectAll(); // highlight the text
((JTextField) e.getSource ()).setToolTipText("text");
-
I have been playing a game for a while under an account, now I have an Itunes card under a different account and would like to use that $$$ to purchase items for my game, but it doesn't let me because the game was downloaded under the original account. How can I use the $$$ in my new account?
same here but i cant purchase a movie or anything
-
Do you need to use an email as an apple ID? We have a family email which is currently the apple ID so I can keep track of purchases but i have 2 iPhones and 2 itouches. Can all 4 devices have different apple ID under the same email address. Also I wanted to know because for the game center we wanted to keep track of each individual not just o e account. DID I MAKE SENSE
Figured it out. Thanks.
-
Bought my hubby an iphone4 and I registered it and opened an apple account for him. I have an iphone 5 (under my own Apple account). I use icloud to sync calendar and contacts with outlook 2007. How do I add my hubby's phone (account) to icloud so I can sync the same contacts and calendar?
On his phone, sign in Settings>iCloud and enable Mail so that he can have his own email address. Then add your account in Settings>Mail, Contacts & Calendars and enable Contacts and Calendars. They will then appear on his phone alongside any syncing he has set up. This will keep your emails separate, or you can add Mail as well so that you can both access that if you want. You can add his account in the same way on your phone and enable any data types you want to sync.
-
I seam to have two Apple accounts under one email address. Can I delete the old one? How do I do this?
KBS wrote:
I seam to have two Apple accounts under one email address.
Are you sure ? As far as I know an Apple ID can only be associated with one email address.
Go to My Apple ID and click Manage your account
KBS wrote:
Can I delete the old one?
Apple IDs cannot be deleted.
Anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID
More Info > http://support.apple.com/kb/HT5622
And here > http://www.apple.com/support/appleid/ -
Is there a way to have two payment cards under one apple id
Is there a way to have two payment cards under one apple id?
You're confusing icloud and itunes store accounts. Individual users should have their own icloud accounts (using their Apple ID) but multiple users can share the same ID for logging into the itunes store account.
-
I have the iphone4 and I have the iTunes downloaded on my computer but. I skipped downloading the itunes10 and went straight to the iTunes 10.5 and now I do not have the ringtones category under library and I am wondering if I can still get that and if I can how
All answers are greatly appreciatedIt's now called Tones. Go to iTunes menu EDIT/PRFERENCES under GENERAL tab, check the Tones Box under Library source to display Tones library in iTunes.
-
I have 2 iphones registered under same account, but both phones had different contacts in them, somehow icloud duplicated, exchanged them, and I turned off the icloud on one of them, while doing that it asked me if I want to keep them on my phone or not. I pressed the one saying not to keep them. I deleted all of them and could not restore the contacts, how do I restore it? when I sign in to my icloud account online it only shows the contacts that were on the other phone. plz help
I access a personal iPhone and iPad, and a business iPhone with the same Apple ID.
The iPhone's passcode lock feature is completely separate from another iPhone or iOS device.
All apps, all paid and free apps include DRM protection which is tied to the Apple ID that was used to download the apps. If some apps were downloaded with one Apple ID and then a new Apple ID is created, in order to download an app update that was installed with the original Apple ID requires using that Apple ID and password. -
Is it possible to have two apple loans under one account?
So back in June my mum took up apple finance so I could get a macbook and pay her each month (I was under 18 at the time and have no credit history) and that went through within a minute no issues..
Now I face another issue, I want the new iphone 5s but still within my current iphone 5 contract I can't get out of but that aside my question is:
Is it possible to have two apple loans under one bank account? (the iphone one being much smaller than the existing mac loan)
If not, I'll simply have to save up £700.
Thanks~Hi babowa,
The reference to two Apple loans led me to believe it was two Apple finance deals in conjunction with, for example, a Barclays Bank tie-up as we appear to have here in the UK. As you suggest, the payment is a matter between the poster and his mom, but I think that behind all this is the question of whether the poster's mom can have two separate accounts in this way. Which of course, she can.
Maybe you are looking for
-
I have a 2011 MBP 15'. It has a core i7 2.4GHz 8gb of ram, and a HD 6750m. I rarely use Lion, I use Windows 7 Enterprise. I boot up my laptop and it turns on fine. Windows loads, but as soon as I plug the MagSafe adapter into the laptop, the display
-
How to get exit code from C code when calling java method via JNI?
Hi, All in my project, i need to call a java method from C code using JNI, yet I do not know how to retrieve the exit code of java program. the java code is like below public static void main(....) if(error){ System.exit(-77);// the exit code is -77
-
Earpice Volume Too Low!!
I switched from Verizon and a RAZR phone to the iPhone last week and the earpiece volume is TOO low!! I can only hear well in a quiet room or when I use the Headphones, but in a restaurant holding the phone up to my ear, forget it, very low volume. H
-
Is caret positioning in right-to-left oriented jtextpane corruptable?
Dear all - Below is a serious problem. I hope I can get help from you experts out there; otherwise, I think it is a bug that should be reported to the JDK developers. I am writing an editor using my own keyboard layout to type in Arabic. To do so, I
-
Composing a view with JSPs passing parameters (JSF 1.2)
hi, I want to include a JSP in another twice. The two includes should work on different backing bean instances. (Of cource the include contains JSF components) Business case: An insurance policy has one reference to a person in the role insured perso