Results 1 to 8 of 8
- 07-25-2007, 08:45 AM #1
Member
- Join Date
- Jul 2007
- Posts
- 5
- Rep Power
- 0
need restore Look and Feel of application back to1.3 when jre is updated to jdk 1.5
Hi,
I have problem upgrading my apllication(swing) from jdk 1.3 to jdk 1.6, But this effects UILook and Feel.
Ineed a solution how i can get restore the Look and Feel back to that of 1.4 version.
Many Thanks Advance......
Praveen.Last edited by praveenrn; 08-11-2007 at 06:29 AM. Reason: came to know actual problem is from 1.3 to 1.4 regarding what i asked
- 07-25-2007, 08:07 PM #2
Member
- Join Date
- Jul 2007
- Posts
- 43
- Rep Power
- 0
Search how change the look and feel and set it in "metal".
I think that jdk 1.3 had it
- 07-26-2007, 08:20 AM #3
Member
- Join Date
- Jul 2007
- Posts
- 5
- Rep Power
- 0
need custom implemetation for Look And Feel to get back the 1.3 in 1.5
Hi,
Could you please provide me sample code will help.
I think you are asking me to add my custom Metal theme and set usin UIManager.
Thanks.Last edited by praveenrn; 03-07-2008 at 08:10 AM.
- 07-26-2007, 07:05 PM #4levent Guest
Hi Praveen,
Yes, you will set it with UIManager but Metal Look and Feel was the standard look and feel of Java. I heard that Sun will change or already changed default look and feel for Java to make it more competitive. So if thsi is the reason, first you should know which look ad feel you were using and then set the LF to it from your Java code explicitly.
- 07-27-2007, 02:53 PM #5
Member
- Join Date
- Jul 2007
- Posts
- 5
- Rep Power
- 0
need solution to get rid of problem caused due to migration from jdk 1.3 to 1.5/1.6
Hi,
Thanks Iam able to get back my Look and Feel almost by using System properties
System.setProperty("swing.noxp","true");
System.setProperty("swing.useSystemFontSettings"," false");
But there is also one more problem left.
I said already that iam migrating application from 1.3 to 1.6/1.5.
I have one class using JScrollBar throwing NullPointer Exception which is working very much fine in jdk 1.3 vesion.
but in the following code iam able to observe that incrButton is assigned with an JButton in version 1.3 But in 1.5 it is assigned with null value. The problem is ihave code that is written Listener on this button. Even though iam able to get the Button in scrollbar. and then i commeted or assigned null and compiled in 1.3 version the buttons are not displayed,what i mean to say is incrButton variable in BasicScrollBarUI is reffering the Button that is visible in scrollbar. But in 1.5 version incrButton is not assigned with JButton and still the Button as able to see in ScrollBar.
An Code is like that Listener has been added to that button because of this NullPointer Exception is coming.
I would like to ask how can i write listener on ArrowButtons in Basic ScrollBarUI. in 1.5
How to get rid of it.
what needs to to be updated for this to be worked in new version
Thanks in Advance....
-----------------------------------------------------------------------
ERROR is
java.lang.NullPointerException
at pms.ExtGridControl$3.installDefaults(ExtGridContro l.java:38)
at javax.swing.plaf.basic.BasicScrollBarUI.installUI( Unknown Source)
at javax.swing.JComponent.setUI(Unknown Source)
at javax.swing.JScrollBar.setUI(Unknown Source)
at pms.ExtGridControl$2.updateUI(ExtGridControl.java: 45)
at javax.swing.JScrollBar.<init>(Unknown Source)
at javax.swing.JScrollBar.<init>(Unknown Source)
at javax.swing.JScrollBar.<init>(Unknown Source)
at pms.ExtGridControl$2.<init>(ExtGridControl.java:33 )
at pms.ExtGridControl.createVerticalScrollBar(ExtGrid Control.java:33)
at javax.swing.JScrollPane.<init>(Unknown Source)
at javax.swing.JScrollPane.<init>(Unknown Source)
at com.borland.jbcl.view.GridView.<init>(GridView.jav a:47)
at com.borland.jbcl.control.GridControl.<init>(GridCo ntrol.java:44)
--------------------------------------------------------------------------
Code
import com.borland.jbcl.control.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
/**
* extends GridControl:
* inserts a new row if the user clicks into the empty area or scrolls down
*/
public class ExtGridControl extends GridControl{
public ExtGridControl() {
super();
addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (null ==hitTest(e.getPoint().x,e.getPoint().y))
addRow();
}
});
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public JScrollBar createVerticalScrollBar() {
JScrollBar scrollBar = new JScrollBar() {
public void updateUI() {
BasicScrollBarUI myUI = new BasicScrollBarUI (){
protected void installDefaults() {
super.installDefaults();
incrButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseReleased(MouseEvent e) {
checkAddRow();
}
});
}
};
setUI(myUI);
}
};
return scrollBar;
}
void checkAddRow() {
try {
if (getRowCount() == getDataSet().getRowCount()) {
SwingUtilities.invokeLater( new Runnable(){
public void run() {
addRow();
}
});
}
}
catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(this,ex.getMessage() );
}
}
private void jbInit() throws Exception {
this.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(KeyEvent e) {
this_keyReleased(e);
}
});
}
void this_keyReleased(KeyEvent e) {
if (e.getKeyCode()== e.VK_ENTER || e.getKeyCode() == e.VK_DOWN)
addRow();
}
}Last edited by praveenrn; 08-03-2007 at 05:21 AM.
- 08-10-2007, 04:21 PM #6
Member
- Join Date
- Jul 2007
- Posts
- 51
- Rep Power
- 0
I'm trying to test your code, but I do not have com.borland.jbcl.control package
can you send it to me?Last edited by mary; 08-10-2007 at 04:23 PM.
- 08-11-2007, 06:22 AM #7
Member
- Join Date
- Jul 2007
- Posts
- 5
- Rep Power
- 0
thanks
Hi iam not able to upload as it exceeds the limit.
And Thanks for your offer to help me.
I have got referencce to the Arrow Buttons from scrollBar.getComponents()[i] method.
So problem is solved.
iam pasting the code for you..
Java Code:import com.borland.jbcl.control.*; import java.awt.Component; import java.awt.event.*; import javax.swing.*; import javax.swing.plaf.basic.*; /** * extends GridControl: * inserts a new row if the user clicks into the empty area or scrolls down */ public class ExtControl extends GridControl{ public ExtControl() { super(); addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (null ==hitTest(e.getPoint().x,e.getPoint().y)) addRow(); } }); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } public JScrollBar createVerticalScrollBar() { JScrollBar scrollBar = new JScrollBar() { public void updateUI() { BasicScrollBarUI myUI = new BasicScrollBarUI (){ protected void installDefaults() { super.installDefaults(); if(incrButton!=null) incrButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(MouseEvent e) { checkAddRow(); } }); } }; setUI(myUI); } }; for(int i=0;i<scrollBar.getComponents().length;i++){ scrollBar.getComponents()[i].addMouseListener(new MouseListener(){ public void mouseClicked(MouseEvent arg0) { // TODO Auto-generated method stub checkAddRow(); } public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub }}); } return scrollBar; } void checkAddRow() { try { if (getRowCount() == getDataSet().getRowCount()) { SwingUtilities.invokeLater( new Runnable(){ public void run() { addRow(); } }); } } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(this,ex.getMessage()); } } private void jbInit() throws Exception { this.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(KeyEvent e) { this_keyReleased(e); } }); } void this_keyReleased(KeyEvent e) { if (e.getKeyCode()== e.VK_ENTER || e.getKeyCode() == e.VK_DOWN) addRow(); } }Last edited by JavaBean; 08-11-2007 at 09:44 PM.
- 08-11-2007, 09:44 PM #8
Similar Threads
-
Swing - Look and feel
By Java Tip in forum Java TipReplies: 0Last Post: 03-11-2008, 10:53 PM -
Need help with my project : Back up application
By riz618 in forum New To JavaReplies: 1Last Post: 01-27-2008, 07:41 AM -
Look and Feel
By arun_kumar in forum AWT / SwingReplies: 1Last Post: 11-17-2007, 06:21 PM -
Running application in back
By fernando in forum Advanced JavaReplies: 1Last Post: 08-01-2007, 12:25 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks