Hi
        I am facing a problem that after changing the title of a titled
border on a swing panel i am not being able to call the border's
paintBorder(...) function correctly. the border is on the panel and
panel.repaint() works perfectly fine but since i am just changing the title
of the border i don't want to repaint the whole panel. the problem is that
the graphics object being passed is null. i don't even know if i'm calling
the function correctly ! i am getting a NullPointerException. 

i am calling the function as:

myBorder.paintBorder(panel, panel.getGraphics(),  0, 0, panel.getWidth(),
panel.getHeight());     // myBorder is attached to panel

and the stack trace is:

Exception occurred during event dispatching: 
java.lang.NullPointerException  
at java.awt.Rectangle.setBounds(Rectangle.java:251)     
at javax.swing.border.TitledBorder.paintBorder(TitledBorder.java:329)   
at myui.MyPanel$1.valueChanged(MyPanel.java:50)         
at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionM
odel.java:170)  
at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionM
odel.java:140)  
at
javax.swing.DefaultListSelectionModel.setValueIsAdjusting(DefaultListSelecti
onModel.java:507)       
at
javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.setValueIsAdjusting(Ba
sicTableUI.java:443)    
at
javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mouseReleased(BasicTab
leUI.java:486) 
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)

at java.awt.Component.processMouseEvent(Component.java:3717)    
at java.awt.Component.processEvent(Component.java:3546)         
at java.awt.Container.processEvent(Container.java:1164)         
at java.awt.Component.dispatchEventImpl(Component.java:2595)    
at java.awt.Container.dispatchEventImpl(Container.java:1213)    
at java.awt.Component.dispatchEvent(Component.java:2499)        
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)    
at java.awt.Container.dispatchEventImpl(Container.java:1200)    
at java.awt.Window.dispatchEventImpl(Window.java:912)   
at java.awt.Component.dispatchEvent(Component.java:2499)        
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)       
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

is there any way i can call this function successfully? or will i have to
use panel.repaint()?

thanks in advance,
jassi

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to