New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus ē Advice and insight from world-class Apple enthusiasts ē Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

java


Post Reply New Thread Subscribe

 
Thread Tools
blue sky

 
Member Since: Mar 20, 2013
Posts: 3
blue sky is on a distinguished road

blue sky is offline
I use Mac computers and I have a small java application that works fine on my Mac running Snow Leopard.

When I take this application onto my Macbook Air running Lion the application doesnít render itself the way it does under Snow Leopard.

The problem is with JTabbedPane. It looses the default blue color when a tab is selected or has the focus (under Snow Leopard itís blue under Lion itís gray) and also it is not possible to see which tabs are enabled or disabled under Lion.

I was wondering if someone might have some suggestions of how to fix this JTabbedPane problem.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,760
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
What versions of Java are you running on each? Do you have a piece of sample code that we can try?

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
blue sky

 
Member Since: Mar 20, 2013
Posts: 3
blue sky is on a distinguished road

blue sky is offline
my imac is running snow leopard version: 10.6.8 and my mackbook air i just upgraded to mountain lion version: 10.8.3 and the same problem on mountain lion it won't render JTabbedPane properly.

i am attaching zipped files with code.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,760
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Thanks but I need to know which versions of Java you're running on each machine.

No zip file is available. Can you post a short snippet that demonstrates the tabbed pane issue?

Mod note: I'm going to move this to a more appropriate forum since this is more of a development question.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
blue sky

 
Member Since: Mar 20, 2013
Posts: 3
blue sky is on a distinguished road

blue sky is offline
snow leopard is running:

Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-10M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)

mountain lion is running:

Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)

here is the code:

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;

public class Grade extends JFrame
{
static JMenu myMenu;
static TabOne tabOne;
static TabTwo tabTwo;
static TabTre tabTre;

static int SW = 800;
static int SH = 550;

static JDesktopPane desk = new JDesktopPane();

static JTabbedPane jtp = new JTabbedPane();
static JMenuBar jmb = new JMenuBar();
static JPanel panel = new JPanel();;

public static void main(String[] args)
{
final Grade f = new Grade();

Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

int w = (d.width-SW)/2;
int h = (d.height-SH)/2;
f.setBounds(w, h, SW,SH);

f.setVisible(true);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}

public Grade()
{
super();

this.setTitle("java");

mkGui();

panel.setLayout(new BorderLayout());

setContentPane(desk);
desk.addComponentListener(new ComponentAdapter()
{
public void componentResized(ComponentEvent e)
{
Dimension d = desk.getSize();
panel.setBounds(0,0, d.width, d.height);
panel.validate();
}
});
desk.add(panel);
}

public void mkGui()
{
Thread w = new Thread()
{
public void run()
{
mkMenu();
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
mkTab();
mkTabListener();
}
});
}
};
w.start();
try
{
w.join();
}
catch (InterruptedException e) {}
}

public void mkMenu()
{
JMenuItem myItem = new JMenuItem("Essentials");
myItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
});

myMenu = new JMenu("Input");

jmb.add(myMenu);
setJMenuBar(jmb);
}

public void mkTab()
{
jtp.addTab("disable extra", null, tabOne = new TabOne(), "");
jtp.addTab("enable extra", null, tabTwo = new TabTwo(), "");
jtp.addTab("extra", null, tabTre = new TabTre(), "");

jtp.setEnabledAt(2, false);

jtp.setTabPlacement(SwingConstants.TOP);
jtp.setBackground(Color.white);
panel.add(jtp);
}

public void mkTabListener()
{
jtp.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
tabHit();
}
});
}

public void tabHit()
{
if (jtp.getTitleAt(jtp.getSelectedIndex()).equals("di sable extra"))
{
jtp.setEnabledAt(2, false);
}
else
if (jtp.getTitleAt(jtp.getSelectedIndex()).equals("en able extra"))
{
jtp.setEnabledAt(2, true);
}
else
if (jtp.getTitleAt(jtp.getSelectedIndex()).equals("ex tra"))
{
}
}

public class TabOne extends JPanel
{
public TabOne()
{
JPanel p1 = new JPanel();
p1.setLayout(new BorderLayout());
p1.add(new JLabel(""), BorderLayout.CENTER);

this.setLayout(new BorderLayout());
this.add(p1, BorderLayout.CENTER);
}
}

public class TabTwo extends JPanel
{
public TabTwo()
{
JPanel p1 = new JPanel();
p1.setLayout(new BorderLayout());
p1.add(new JLabel(""), BorderLayout.CENTER);

this.setLayout(new BorderLayout());
this.add(p1, BorderLayout.CENTER);
}
}

public class TabTre extends JPanel
{
public TabTre()
{
JPanel p1 = new JPanel();
p1.setLayout(new BorderLayout());
p1.add(new JLabel(""), BorderLayout.CENTER);

this.setLayout(new BorderLayout());
this.add(p1, BorderLayout.CENTER);
}
}
}
QUOTE Thanks

Post Reply New Thread Subscribe


« Size of Arrays | Limit Stacksize OSX 10.8 »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Explaining the Java Situation vansmith OS X - Apps and Games 11 12-04-2013 09:50 AM
Java problems. Apple care reply. Is it true? magnitude OS X - Apps and Games 21 09-12-2012 04:05 PM
Java problems - please help! macsareshiny OS X - Operating System 0 02-19-2012 12:08 PM
Software Update: Java for Mac OS X 10.6 Update 5, Mac OS X 10.5 Update 10 OneMoreThing... Apple Rumors and Reports 0 06-28-2011 06:55 PM
Java From Terminal jdgti OS X - Development and Darwin 10 03-26-2005 07:16 PM

All times are GMT -4. The time now is 10:15 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?