Is swing does not work in jdk1.4?
Sirs,
I've tried to compile the following code,
import javax.swing.*;
public class HelloWorldSwing {
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Add the ubiquitous "Hello World" label.
JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
//Display the window.
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
But I got the following error,
C:\j2sdk1.4\bin>javac HelloWorldSwing.java
HelloWorldSwing.java:2: package javax.awt does not exist
import javax.awt.*;
^
HelloWorldSwing.java:9: cannot resolve symbol
symbol : constructor JFrame (java.lang.String)
location: class JFrame
JFrame frame = new JFrame("HelloWorldSwing");
^
2 errors
Does Jdk1.4 is not compatible for executing Swing applications?
Thanks in advance.
How long have you been using Java? Swing has been in the javax.swing package for a long time now.
Your compiler errors don't match your source:
import javax.swing.*;
vs
C:\j2sdk1.4\bin>javac HelloWorldSwing.java
HelloWorldSwing.java:2: package javax.awt does not exist
import javax.awt.*;
Similar Messages
-
JNLP - Swing application compiled in jdk1.5 not working in jdk1.6
I have one swing application, compiled in jdk 1.5 and deployed in JNLP with jdk 1.5. When client machine try to access the application and having jre 1.5 then it works fine. but if client machine having jre 1.6 or version greater than 1.5 then application does not work properly.
Please help me, i got stuck and not able to solve the problem.
this is my JNLP
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://10.1.1.145:8080/uttimesheet" href="launch.jnlp">
<information>
<title>TimeSheet Portal</title>
<vendor>Geometric Global</vendor>
<description>A simple java desktop application based on Swing Application Framework</description>
<description kind="short">TimeSheet Portal</description>
<homepage href="http://appframework.dev.java.net"/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+" />
<jar href="UTTimeSheet.jar" main="true" download="eager"/>
<jar href="lib/antlr-2.7.5H3.jar" download="eager"/>
<jar href="lib/appframework-1.0.3.jar" download="eager"/>
<jar href="lib/asm.jar" download="eager"/>
<jar href="lib/cglib-2.1.jar" download="eager"/>
<jar href="lib/commons-collections-2.1.1.jar" download="eager"/>
<jar href="lib/commons-logging-1.0.4.jar" download="eager"/>
<jar href="lib/dom4j-1.6.jar" download="eager"/>
<jar href="lib/hibernate3.jar" download="eager"/>
<jar href="lib/jta.jar" download="eager"/>
<jar href="lib/log4j-1.2.9.jar" download="eager"/>
<jar href="lib/poi-3.0.2.jar" download="eager"/>
<jar href="lib/postgresql-8.3-603.jdbc3.jar" download="eager"/>
<jar href="lib/swing-layout-1.0.3.jar" download="eager"/>
<jar href="lib/swing-worker-1.1.jar" download="eager"/>
<jar href="lib/swingx-0.9.2.jar" download="eager"/>
</resources>
<application-desc main-class="timesheetproject.TimeSheetProjectApp">
</application-desc>
</jnlp>
Thanks in Advance.Thanks Luca for your time,
we have deployed application in tomcat and changed the home page of tomcat to our application home page(html page). and url is http://10.1.1.145:8080/
Application home page contain link to jnlp. so whenever user click on link (in home page) then jnlp will execute and launch the swing application.
do you need some more clarification?
below is the home page(html).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Launch TimeSheet Portal via JNLP</title>
</head>
<body>
<center>
<br>
<img src="images/Geo-logo.JPG" />
<br>
<hr width="70%" />
<br>
<table width="70%">
<tr><td> </td></tr>
<tr>
<td colspan="2" align="center">
<align="center">
<h2>Welcome to TimeSheet Portal.</h3>
</align>
</td>
</tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr>
<td align="center">
<align="center">
<h3><u>Live Sites:</u></h3>
</align>
</td>
<td align="center">
<align="center">
<h3><u>Demo Sites:</u></h3>
</align>
</td>
</tr>
<tr>
<td width="50%" align="center">
<img src="images/launchPortal.png" onmouseover="this.src='images/launchPortalMouseOver.png';" onmouseout="this.src='images/launchPortal.png';" border="0"/>
<br><br>
<img src="images/launchAdminPortal.png" onmouseover="this.src='images/launchAdminPortalMouseOver.png';" onmouseout="this.src='images/launchAdminPortal.png';" border="0"/>
</td>
<td width="50%" align="center">
<img src="images/demoPortal.png" onmouseover="this.src='images/demoPortalMouseOver.png';" onmouseout="this.src='images/demoPortal.png';" border="0"/>
<br><br>
<img src="images/demoAdminPortal.png" onmouseover="this.src='images/demoAdminPortalMouseOver.png';" onmouseout="this.src='images/demoAdminPortal.png';" border="0"/>
</td>
</tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
</table>
<table width="70%">
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td align="center">
FAQ |
Help |
Why Timesheet |
Report a bug |
Contact Us |
Subtask Mapping
</td></tr>
</table>
<br><br><br><br>
<table width="70%" bgcolor="#C0C0C0" style="vertical-align: bottom">
<tr>
<td colspan="2" align="center" style="vertical-align: bottom" bgcolor="#C0C0C0">
©<font size="1.5" face="Verdana"> 2008 Geometric Ltd. All rights reserved.<br>
Best optimized for a resolution of 1024 and above. JRE 1.5 is a pre-requisite for using these applications.
</font>
</td>
</tr>
</table>
</center>
</body>
</html>
Thanks. -
I wonder if this is a known issue: Since I upgrade the jdk1.6 version to the _07 pack, text IO does not work anymore with WinXP cmd.exe window. Assuming a static import of System.out, I use:
static void prompt()
out.print(pr); //pr is a prompt string...
out.flush();
}works as usual with Unix/Linux, but with windows nothing will be written to the terminal, until I make at least one input. In that case a barrage of cached prompts appear all at once.
Do we have a bug for it, can we work around somehow?
ThomasSince this code works correctly in Java 6u10 on Windows XP
System.out.print("This is the data");
System.out.flush();You are apparently doing something unusual or wrong. What is "out"?
Show a small sample program that compiles and exhibits the problem when executed. -
Early Adopter release : Extract DDL for tables does not work
Hi,
just had a look at Raptor - really nice tool - easy install - could be a replacement for SQLnavigator for us. One or two things I noticed though ...
1)
Export->DDL for tables does not work throws following error
java.lang.ClassNotFoundException: oracle.dbtools.raptor.dialogs.actions.TableDMLExport
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at oracle.ideimpl.IdeClassLoader.loadClass(IdeClassLoader.java:140)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at oracle.dbtools.raptor.dialogs.BasicObjectModifier.launch(BasicObjectModifier.java:142)
at oracle.dbtools.raptor.dialogs.BasicObjectModifier.handleEvent(BasicObjectModifier.java:210)
at oracle.dbtools.raptor.dialogs.actions.XMLBasedObjectAction$DefaultController.handleEvent(XMLBasedObjectAction.java:265)
at oracle.ide.controller.IdeAction.performAction(IdeAction.java:530)
at oracle.ide.controller.IdeAction$1.run(IdeAction.java:785)
at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:804)
at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:499)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
and 2)
when I click on a package body - I get "loading ..." below it but it never puts the
procedure names in and the "loading ..."message stays in the tree view - however you do get to see the packages in the source window.
Realise this is very much a work in progress and am grateful to see an early release such as this. Looking forward to the production release.
Best regards,
David.OK thanks for looking ....you've obviously got the fixes on your to do lists
Noticed that the SQL tab when you select an object works fine - displays the
DDL for the object
Do you think you'll have functionality so you can select many objects (shift left click) and
then create a DDL script for them? It looks like you can do this for all objects in a schema but
the ability to select a subset of objects in a schema would be very useful for our DBA's.
Couldn't see any good reason for keeping using SQLNavigator
Many congratulations on producing such a useful tool.
Kind regards,
David. -
JCombox does not work under linux (fedora) could you help me???
Hi All,
I am implementing a GUI for a linux application. This GUI works fine under windows system. But the JCombobox does not work under Linux system. Would you help me to solve it? Thank you very much!..
The problem is that I cannot select any other item except the first item in the dropdown box of JCombobox. There is no event generated when I click the combobox, while events are generated for other Buttons.
This problem exists for the following code when I maximize the window. When the window is minimize to some extend in my problem, it is OK.
Here is the simplify code:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.event.ListDataEvent;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.event.*;
import javax.swing.*;
//carmen
import javax.swing.filechooser.*;
import javax.swing.event.*;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.border.*;
//import AlwaysSelectableComboBoxDemo.AlwaysSelectableComboBox;
//import AlwaysSelectableComboBoxDemo.AlwaysSelectableComboBox;
import java.io.*;
import java.util.*;
import java.lang.String.*;
public class Test extends JFrame
private JComboBox jComboBox1;
private JComboBox jComboBox2;
private JPanel contentPane;
private JTabbedPane jTabbedPane1;
//Main Tab
private JPanel Main;
private JPanel OutputSimSet;
private JPanel Test;
private JPanel ScriptGenTab;
private JPanel ResultTab;
//Result Tab
private JPanel SimResult;
public Test()
super();
//initializeComponent();
contentPane = (JPanel)this.getContentPane();
jTabbedPane1 = new JTabbedPane();
Main = new JPanel();
OutputSimSet = new JPanel();
Test = new JPanel();
ScriptGenTab = new JPanel();
ResultTab = new JPanel();
SimResult = new JPanel();
jComboBox1 = new JComboBox(
new String[]{"Item 1","Item 2", "Item 3"});
jComboBox1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
System.out.println("Yeah");
jComboBox2 = new JComboBox(
new String[]{"Item 1","Item 2", "Item 3"});
jComboBox2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
System.out.println("Yeah");
// jTabbedPane1
jTabbedPane1.addTab("Main", Main);
jTabbedPane1.addTab("ScriptGenerator", ScriptGenTab);
jTabbedPane1.addTab("Simulation Result", ResultTab);
jTabbedPane1.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e)
jTabbedPane1_stateChanged(e);
// contentPane
contentPane.setLayout(new BorderLayout(0, 0));
contentPane.add(jTabbedPane1, BorderLayout.CENTER);
// Main
//Main.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
Main.setLayout(new BorderLayout(0, 0));
Main.add(OutputSimSet,BorderLayout.NORTH);
OutputSimSet.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
OutputSimSet.add(Test, 0);
Test.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
Test.add(jComboBox1,0);
//ResultTab
ResultTab.setLayout(new BorderLayout(0, 0));
ResultTab.setBorder(new TitledBorder(""));
ResultTab.add(SimResult, BorderLayout.NORTH);
SimResult.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
SimResult.add(jComboBox2,0);
// Test
this.setTitle("Test");
this.setLocation(new Point(0, 0));
this.setSize(new Dimension(600, 500));
this.setVisible(true);
public void initializeComponent()
/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int width,int height)
c.setBounds(x,y,width,height);
container.add(c);
// TODO: Add any appropriate code in the following Event Handling Methods
private void jTabbedPane1_stateChanged(ChangeEvent e)
System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");
// TODO: Add any handling code here
// TODO: Add any method code to meet your needs in the following area
// TODO: Add any appropriate code in the following Event Handling Methods
private void jComboBox1_actionPerformed(ActionEvent e)
System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called.");
Object o = jComboBox1.getSelectedItem();
System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
// TODO: Add any handling code here for the particular object being selected
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Create and set up the window.
Test frame = new Test();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}package oct03_JCBox;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class Test extends JFrame
private JComboBox jComboBox1;
private JComboBox jComboBox2;
private JPanel contentPane;
private JTabbedPane jTabbedPane1;
//Main Tab
private JPanel Main;
//private JPanel OutputSimSet;
//private JPanel Test;
private JPanel ScriptGenTab;
private JPanel ResultTab;
//Result Tab
//private JPanel SimResult;
public Test()
super();
//initializeComponent();
contentPane = (JPanel)this.getContentPane();
jTabbedPane1 = new JTabbedPane();
Main = new JPanel();
ScriptGenTab = new JPanel();
ResultTab = new JPanel();
// OutputSimSet = new JPanel();
// Test = new JPanel();
// SimResult = new JPanel();
jComboBox1 = new JComboBox(
new String[]{"Item 1","Item 2", "Item 3"});
jComboBox1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
System.out.println("Yeah");
jComboBox2 = new JComboBox(
new String[]{"Item 1","Item 2", "Item 3"});
jComboBox2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
System.out.println("Yeah");
// Main
//Main.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
Main.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
Main.add(jComboBox1);
//ResultTab -----
ResultTab.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
ResultTab.add(jComboBox2);
// jTabbedPane1
jTabbedPane1.addTab("Main", Main);
jTabbedPane1.addTab("ScriptGenerator", ScriptGenTab);
jTabbedPane1.addTab("Simulation Result", ResultTab);
jTabbedPane1.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e)
jTabbedPane1_stateChanged(e);
// contentPane
contentPane.setLayout(new BorderLayout(0, 0));
contentPane.add(jTabbedPane1, BorderLayout.CENTER);
// Test
this.setTitle("Test");
this.setLocation(new Point(0, 0));
this.setSize(new Dimension(600, 500));
this.setVisible(true);
public void initializeComponent()
// /** Add Component Without a Layout Manager (Absolute Positioning) */
// private void addComponent(Container container,Component c,int x,int y,int width,int height)
// c.setBounds(x,y,width,height);
// container.add(c);
// TODO: Add any appropriate code in the following Event Handling Methods
private void jTabbedPane1_stateChanged(ChangeEvent e)
System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");
// TODO: Add any handling code here
// TODO: Add any method code to meet your needs in the following area
// TODO: Add any appropriate code in the following Event Handling Methods
// private void jComboBox1_actionPerformed(ActionEvent e)
// System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called.");
// Object o = jComboBox1.getSelectedItem();
// System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
// // TODO: Add any handling code here for the particular object being selected
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Create and set up the window.
Test frame = new Test();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
} Try this - you use too many unnecessary JPanels.
Which way you prefer with actionPerformed should work either way.
I think your problem was too many unnecessary Panels and set all attributes before it is added, perhaps,
not add the panel first and then try to set attributes like layout, color, etc... -
DoClick does not work!!!
For my simple browser I have created a button that allows you to enlarge the size of the text. Now when the page is loaded and you click this button the text size increases as desired.
However I want the text to automatically change to large when the webpage is loaded. So after the setpage method I used largeTxt.doClick() this does not seem to work.
Can you please help me solve this problem, my code is below.
Thanks.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
import java.net.*;
import java.io.*;
import javax.swing.text.html.*;
import javax.swing.text.*;
import java.util.*;
public class simpleBrowser extends JFrame implements ActionListener, HyperlinkListener {
public static final String HOME_DEFAULT = "http://www.cs.nott.ac.uk/~nza";
protected String currentURL = HOME_DEFAULT;
private BorderLayout border;
private Container content;
private JButton buttonGo, largeText ;
private JTextField textURL;
private JLabel labelEnterURL;
private JEditorPane htmlMain;
private JPanel panel;
private JScrollPane scrollPane;
private URL url;
private String urlString;
final JLabel statusBar = new JLabel(" ");
String display;
public simpleBrowser (String startPage) throws MalformedURLException, IOException {
super("Simple Browser");
setSize(600,500);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
we.getWindow().setVisible(false);
System.exit(0);
border = new BorderLayout();
content = this.getContentPane();
content.setLayout(border);
buttonGo = new JButton("GO!");
buttonGo.addActionListener(this);
largeText = new JButton("Large Text");
largeText.addActionListener(this);
textURL = new JTextField(startPage, 40);
textURL.setToolTipText("Key in the URL required here");
labelEnterURL = new JLabel("Enter the URL:");
url = new URL(startPage);
htmlMain = new JEditorPane(url);
htmlMain.setEditable(false);
htmlMain.addHyperlinkListener(this);
scrollPane = new JScrollPane(htmlMain);
panel = new JPanel();
panel.setLayout(new FlowLayout());
panel.add(labelEnterURL);
panel.add(textURL);
panel.add(buttonGo);
panel.add(largeText);
content.add(panel, BorderLayout.NORTH);
content.add(scrollPane, BorderLayout.CENTER);
content.add(statusBar, BorderLayout.SOUTH);
this.pack();
this.setVisible(true);
} // End constructor
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(buttonGo)){
DisplayPage(textURL.getText());
} // End if
if (e.getSource().equals(largeText)){
Thread runner = new Thread() {
public void run() {
HTMLDocument doc = ((HTMLDocument) htmlMain.getDocument());
doc.setCharacterAttributes(0, htmlMain.getDocument().getLength(), doc.getStyleSheet()
.getDeclaration("font-size:24"), false);
runner.start();
} // End if
} // End actionPerformed
public void hyperlinkUpdate(HyperlinkEvent e) {
HyperlinkEvent.EventType eventType = e.getEventType();
if (eventType == HyperlinkEvent.EventType.ACTIVATED) {
try {
htmlMain.setPage(e.getURL());
} catch (Exception myException) {
htmlMain.setText("Link error");
} // End try-catch
} // End if
} // End hyperlinkUpdate
public static void main(String[] args) throws MalformedURLException, IOException {
simpleBrowser myBrowser = new simpleBrowser(HOME_DEFAULT);
} // End main
public void DisplayPage(String strURL) {
currentURL = strURL;
textURL.setText(strURL);
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
htmlMain.setPage(strURL);
//largeText.doClick();
catch (Exception exc) {
htmlMain.setText("");
statusBar.setText("Could not open starting page. Using a blank.");
finally {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} //end try
largeText.doClick();
} // End classI tried your suggesstions to change the methods as shown below but it still does not work. :(
if (e.getSource().equals(largeText)){
Thread runner = new Thread() {
public synchronized void run() {
HTMLDocument doc = ((HTMLDocument) htmlMain.getDocument());
doc.setCharacterAttributes(0, htmlMain.getDocument().getLength(), doc.getStyleSheet()
.getDeclaration("font-size:24"), false);
runner.start();
SwingUtilities.invokeLater(runner);
} // End if
public void DisplayPage(String strURL) {
currentURL = strURL;
textURL.setText(strURL);
//m_btnReload.setToolTipText(strURL);
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
htmlMain.setPage(strURL);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
largeText.doClick();
catch (Exception exc) {
htmlMain.setText("");
statusBar.setText("Could not open starting page. Using a blank.");
finally {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} //end try
//largeText.doClick();
} -
JTextField actionListener does not work
I am writing an application, and I am using Swing and consequently JTextFields. There is a JTextField whose actionListener works when I use the compiling environment to run the application, but it is not working when I run it from a piece of code written in Visual Basic. All the others JTextFields work properly.
Any idea coming up?
May it be any conflict with Microsoft?Veena,
Always mention your JDev version.
When used in combination, the actionListener is either ignored or the popwarning.show does not work.Can you elaborate the above? Does this happen everytime? Can you also check what is the value for validator.addWarningIfCityNotApproved() - you can run the app in Debug mode to see where exactly it fails ?
-Arun -
Expert Mode ViewObject: default 'query by example' mechanism does not work
In JDeveloper 11G 1.1.1
I have created an Expert Mode view object(VO) which I'm trying to filter in an ADF Swing Panel
The Panel contains a Swing Table created by dropping a VO data control on the panel as an ADF bound Swing Table.
TEST
Run the panel.
Set the Query Mode on (from the Database menu)
Enter a relevant view criterion
Execute the Query
TEST FAILS
Table is refreshed but it still displays the entire VO collection (non-filtered).
Repeating the same experiment with a default, entity object generated VO works as expected.
Question
Can the default 'query-by-example' mechanism as provided by the JUTestFrame and the JUNavigationBar be used with Expert Mode view Objects?
If yes are there any tricks to making this work?Hello Frank;
Additional TEST RESULTS
In JDev11G
The default 'query by example mechanism' does not work if you create a new View Object using the <Select data source...> option <Read-only access through SQL query>.
However, IT DOES WORK if you create a new ViewObject selecting <Updatable access through entity objects> and in the Query step you select <Expert Mode>
Could you please check and confirm.
Thanks!
Ioannis
Edited by: imouts on Dec 5, 2008 1:38 PM -
Hi all,
in JDK 1.4.0 we can use the copy/paste between the java applets and other windows applications but in JDK 1.4.1_01 it does not work more!!!
there is a simple JApplet code:
import java.awt.*;
import javax.swing.*;
public class JApplet1 extends JApplet
public void init()
getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
getContentPane().setLayout(null);
setSize(426,266);
getContentPane().add(JTextField1);
JTextField1.setBounds(72,72,283,64);
javax.swing.JTextField JTextField1 = new javax.swing.JTextField();
and the start html page the the Japplet
<HTML>
<HEAD>
<TITLE>Autogenerated HTML</TITLE>
</HEAD>
<BODY>
<OBJECT classid="clsid:CAFEEFAC-0014-0001-0000-ABCDEFFEDCBA"
width="500" height="200" >
<PARAM name="code" value="JApplet1.class">
<PARAM name="codebase" value=".">
<PARAM name="type" value="application/x-java-applet;jpi-version=1.4.1">
<PARAM name="scriptable" value="true">
No Java 2 SDK, Standard Edition v 1.4.1 support for APPLET!!
</OBJECT>
</BODY>
</HTML>
Any ideas?
Best regardsHi,
I have found out the cause for the issue: before you install 1.4.1_01.exe you must deinstall all JRE's on your computer (1.3.XX, 1.4.0.XX) than works that well the Copy/Paste.
that is confusingly because we don't have to make that in JRE 1.4.0.
Best regards -
TableChanged() does not work with parrent table reference
Hi,
I used this example http://www.javalobby.org/articles/jtable/ where the cells refocus after updating, but I have rewrote it to my needs and the program throws nullpointerexception when I update any cell:(
here is the tableChanged part of code:
public class InteractiveTableModelListener implements TableModelListener {
public void tableChanged(TableModelEvent evt) {
if (evt.getType() == TableModelEvent.UPDATE) {
int column = evt.getColumn();
int row = evt.getFirstRow();
System.out.println("updated row: " + row + " column: " + column);
if((column + 1) >= model.getRowCount()){
table.removeColumnSelectionInterval(column,column);
}else{
table.setColumnSelectionInterval(column + 1, column + 1);
table.setRowSelectionInterval(row,row);
}the table reference worked in the exaple but doesnt work in my program:(
here is the init of the table in function initComponent:
tableModel.addTableModelListener(new InteractiveTableModelListener());
TableSorter sorter = new TableSorter(tableModel);
JTable table = new JTable(sorter);the class is on the same level as the function
i have searched all the internet for this with no results:(
thank you for your advice!Yes, you are right, I wrote this post in a hurry and exhaused, that it does not work.
I'm trying to write out a data file (now only a vector of data) in a JTable and I want to edit the rows and after I submit text in a cell, I want the caret to move one cell right, so the user can write another text, just like in MS Excel. At the end of the row the caret disapears but does not create another row.
And I have problems with variable JTable table in the inner class that contains method tableChanged().
Well After making an example I realized it worked and then I checked the example line by line and found out that I declare another JTable with the same name in the table initializing method,
Then the variable couldnt work in tableChanged method... It was empty...
I used your example from thread, you advised me:
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
public class TableProcessing extends JFrame implements TableModelListener
// here I declare the table
protected JTable table;
public TableProcessing()
String[] columnNames = {"Item", "Quantity", "Price", "Cost"};
Object[][] data =
{"Bread", new Integer(1), new Double(1.11), new Double(1.11)},
{"Milk", new Integer(1), new Double(2.22), new Double(2.22)},
{"Tea", new Integer(1), new Double(3.33), new Double(3.33)},
{"Cofee", new Integer(1), new Double(4.44), new Double(4.44)}
DefaultTableModel model = new DefaultTableModel(data, columnNames);
model.addTableModelListener( this );
// here I declare it again, which is a MISTAKE
JTable table = new JTable( model )
// Returning the Class of each column will allow different
// renderers to be used based on Class
public Class getColumnClass(int column)
return getValueAt(0, column).getClass();
// The Cost is not editable
public boolean isCellEditable(int row, int column)
int modelColumn = convertColumnIndexToModel( column );
return (modelColumn == 3) ? false : true;
table.setPreferredScrollableViewportSize(table.getPreferredSize());
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
* The cost is recalculated whenever the quantity or price is changed
public void tableChanged(TableModelEvent e)
System.out.println(e.getSource());
if (e.getType() == TableModelEvent.UPDATE)
int row = e.getFirstRow();
int column = e.getColumn();
if (column == 1 || column == 2)
// AND here is not initialised - throws NullPointerException
TableModel model = table.getModel();
int quantity = ((Integer)model.getValueAt(row, 1)).intValue();
double price = ((Double)model.getValueAt(row, 2)).doubleValue();
Double value = new Double(quantity * price);
model.setValueAt(value, row, 3);
public static void main(String[] args)
TableProcessing frame = new TableProcessing();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible(true);
} -
Drag and Drop example porting to Linux does not work
Hi Guys,
Encountered this problem : I have a JFrame that displays the name and path of a file that is dragged from a Windows(Explorer) environment into the frame. This works seamlessly in Windows. However, porting to Linux and doing the same thing(dragging the file from File Manager into the Frame to display the file name and path) does not work.
I suspect the case may be something to do with the flavormap.properties file found in the jdk1.xx/jre/lib file. Can anyone help?
RGHi,
I don't know what is causing the problem, but I have been able to avoid it by starting Jdeveloper from $home\jdev\bin\jdev.exe.
Regards,
Mathias -
JSpinner.setFont() does not work
Hi,
I tried to change the font on my JSpinner, but i does not work. :(
SpinnerDateModel sdmMonthModel = new SpinnerDateModel();
sdmMonthModel.setCalendarField(Calendar.MONTH);
JSpinner gMonthSpinner = new JSpinner(sdmMonthModel);
gMonthSpinner.setFont(FONT);
JSpinner.DateEditor deMonthEditor = new JSpinner.DateEditor(
gMonthSpinner, "MMMM"
deMonthEditor.setFont(FONT);
gMonthSpinner.setEditor(deMonthEditor);any suggestions?If you search the bug database for JSpinner setFont, you'll see this
bug at the top of the list.
http://developer.java.sun.com/developer/bugParade/bugs/4656590.html
This will be fixed in a future release. In the meantime, try:
deMonthEditor.getTextField().setFont(FONT);Leif Samuelsson
Java Swing Team
Sun Microsystems, Inc. -
Installed Premiere Pro CS4 but video display does not work?
I just got my copy of CS$. After installing Premiere I found two things that seem very wrong:
1) video display does not work, not even the little playback viewer next to improted film clips located on the project / sequence window. Audio works fine.
2) the UI is way too slow for my big beefy system.
My pc is a dual boot Vista-32 and XP system with 4GB of memory installed and nvidia geforce 280 graphics board with plenty of GPU power. The CS4 is installed on the Vista-32 partition. My windows XP partition on the same PC with Premiere CS2 works great and real fast.
Any ideas how to solve this CS4 install issue?
RonI would like to thank Dan, Hunt, and Haram:
The problem is now very clear to me. The problem only shows up with video footage imported into PP CS4 encoded with "MS Video 1" codec. So this seems to be a bug. The codec is very clearly called out and supported within various menues but video with this codec just will not play in any monitor or preview window. In addition the entire product looks horrible with respect to performance while PP CS4 trys its best to play the video. Audio will start playing after about 30 seconds. And once in awhile part of video shows up at the wrong magnification before blanking out again.
My suggestion to the Adobe team: fix the bug and add some sample footage to the next release so new installations can test their systems with known footage.
My PC is brand new with the following "beefy" components:
Motherboard
nForce 790i SLI FTW
Features:
3x PCI Express x16 graphics support
PCI Express 2.0
NVIDIA SLI-Ready (requires multiple NVIDIA GeForce GPUs)
DDR3-2000 SLI-Ready memory w/ ERP 2.0 (requires select third party system memory)
Overclocking tools
NVIDIA MediaSheild w/ 9 SATA 3 Gb/sec ports
ESA Certified
NVIDIA DualNet and FirstPacket Ethernet technology
Registered
CPU: Intel Core 2 Quad Q9550
S-Spec: SLAWQ
Ver: E36105-001
Product Code: BX80569Q9550
Made in Malaysia
Pack Date: 09/04/08
Features:
Freq.: 2.83 GHz
L2 Cache: 12 MHz Cache
FSB: 1333 MHz (MT/s)
Core: 45nm
Code named: Yorkfield
Power:95W
Socket: LGA775
Cooling: Liquid Cooled
NVIDIAGeForce GTX 280 SC graphics card
Features:
1 GB of onboard memory
Full Microsoft DirectX 10
NVIDIA 2-way and 3-way SLI Ready
NVIDIA PureVideo HD technology
NVIDIA PhysX Ready
NVIDI CUDA technology
PCI Express 2.0 support
Dual-link HDCP
OpenGL 2.1 Capaple
Output: DVI (2 dual-link), HDTV
Western Digital
2 WD VelociRaptor 300 GB SATA Hard Drives configured as Raid 0
Features:
10,000 RPM, 3 Gb/sec transfer rate
RAM Memory , Corsair 4 GB (2 x 2 GB) 1333 MHz DDR3
p/n: TW3X4G1333C9DHX G
product: CM3X2048-1333C9DHX
Features:
XMS3 DHX Dual-Path 'heat xchange'
2048 x 2 MB
1333 MHz
Latency 9-9-9-24-2T
1.6V ver3.2 -
A2109 tablet autorotate does not work
The autorotation on my recently purchased tablet A2109 does not work. I look in settings and the auto rotate field is not highlighted, I therefore cannot choose to turn it on.The tablet has the Android jellybean OS and I did update it but to no avail. Can anyone help?
Thanks
Solved!
Go to Solution.Dear tdsouza
Welcome in lenovo forums
just a clarification , do you mean option Rotate is dimmed in setting
Please let me know
Thanks
Alaa
Did someone help you today? Press the star on the left to thank them with a Kudo!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
Follow @LenovoForums on Twitter! -
For what reason on my tablet with OS Android 4.1 does not work flash on the sites?
Hi! I recently bought a Google Nexus 7 tablet with Android 4.1 operating system and on my tablet does not work flash sites. Why adobe does not release a new version of flash for android 4.1? Why it was necessary to buy a company Macromedia, if adobe does not want to develop web technology? I think against Adobe can sue for violation of antitrust
I found this for example:
http://www.slashgear.com/adobe-no-jelly-bean-flash-flash-player-pulled-altogether-august-1 5-29236404/
Maybe you are looking for
-
I've been having an issue with my Macbook Pro which started possibly two weeks before April 21st. My computer screen went black while I was in the process of using it. The fans were still going, I pressed a button to see if it were asleep but nothing
-
Finding and deleting unused images
There's got to be an easy way to find all the unused image files (or any other type of file) so that they can be managed - in my case deleted. I'm trying to clean up my site - getting rid of unused files. I had a lot of selections for images but used
-
BPM an Mapping: Get the workflow instance number?
Hi everybody, wen need in some cases the message-ID that was generated in message-mapping. But when I take this message-ID and try to find it via SXMB_MONI the message could'nt be found due to reasons I do not know. So now I would like to capture the
-
No pop-up for client certificate in spite of icm/HTTPS/verify_client = 1
Dear experts, on my WebAS 6.40 I have set icm/HTTPS/verify_client = 1 so that it requests a client certificate every time a new SSL connection is established. However, only on one client machine with IE 6 I really get a pop-up asking for a client cer
-
Help with importing Mail messages from cloned system
I decided to format and reinstall Snow Leopard on my iMac. Before I did, I backed everything up and, following Apples instructions, thought I had saved all my mail messages etc. It didnt work, or at least, I couldnt get it to work! So, I need help ge