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

Similar Messages

  • JButton ActionListener does not work when Button is in JTable

    I have created a renderer to enable a button to be displayed in a JTable. The buttons purpose is to enable the user to delete the corresponding row. Before the button was rendered by the renderer I set the corresponding action listener on the JButton but it nevers fires. Is there a simple of way of achieving what I want without having to create a custom editor. An editor seems overkill for such a simple task.
    Thanks
    Juccky

    why is the editor overkill? You can put it in ~10 lines of code - just return an instance of your renderer...

  • 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 class

    I 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();
    }

  • Visible attribute does not work for af:showDetailItem using EL

    I cannot get the visible attribute to work using EL and ppr.
    Here is a simple test. I have a jspx with a button (cb1) that toggles a boolean (tab1visible) in a Backing Bean. The af:panelTabbed and af:showDetailItem have partialTriggers="cb1".
    The af:showDetailItem has visible="#{TabTestBk.tab1visible}" and the EL is also set in the title so that I can see how it's set.
    When I press the button (cb1) the visibility of the tab does not change but the title does.
    Any help would be greatly appreciated!
    Here is the code:
    ------------------------- JSPX -----------------------------------------------------
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document>
    <af:form>
    <af:spacer height="10"/>
    <af:commandButton text="Toggle Tab 1 - visible = #{TabTestBk.tab1visible}" binding="#{TabTestBk.cb1}"
    id="cb1"
    actionListener="#{TabTestBk.toggleTab1AL}"/>
    <af:spacer height="20"/>
    <af:panelTabbed id="detailNavPane" partialTriggers="cb1">
         <af:showDetailItem id="tab1" visible="#{TabTestBk.tab1visible}" text="Tab 1 visible = #{TabTestBk.tab1visible}" partialTriggers="cb1">
                                  <af:outputText value="Tab 1 Content"/>
    </af:showDetailItem>
    <af:showDetailItem id="tab2" text="Tab 2">
                                  <af:outputText value="Tab 2 Content"/>
    </af:showDetailItem>
    <af:showDetailItem id="tab3" text="Tab 3">
                                  <af:outputText value="Tab 3 Content"/>
    </af:showDetailItem>
    </af:panelTabbed>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    ------------------------- BACKING BEAN -----------------------------------------------------
    package com.riscs.ui.backing.jsp.claim;
    import javax.faces.event.ActionEvent;
    import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
    public class TabTestBk {
    private RichCommandButton cb1;
    private boolean tab1visible = true;
         public void toggleTab1AL(ActionEvent event) {
              setTab1visible(!tab1visible);
         public void setTab1visible(boolean tab1visible) {
              this.tab1visible = tab1visible;
         public boolean isTab1visible() {
              return tab1visible;
    public void setCb1(RichCommandButton cb1) {
    this.cb1 = cb1;
    public RichCommandButton getCb1() {
    return cb1;
    Thanks!
    Matt
    Edited by: Matt Cannon IBI on Apr 3, 2010 2:45 PM
    Edited by: Matt Cannon IBI on Apr 5, 2010 12:20 AM

    Hi Frank,
    Thanks for the reply! When providing the simple example I left partialSubmit="true" off by mistake... I put it on and still does not work...
    Thanks,
    Matt

  • This program is well compiled but does not work.

    I would like to know why this program does not work properly:
    the idea is :
    1. the user introduces a text as a string
    2.the progam creates a file (with a FileOutputStream)
    3. then this file is encripted according to DES (using JCE, cipheroutputStream)
    4.the new filw is an encripte file, whose content is introduced in a string (with a FileInputStream)
    (gives no probles of compilation!!)
    (don know why it does not work)
    here goes the code:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.io.*;
    import java.security.*;
    import javax.crypto.*;
    public class cuadro extends Applet{
         private TextArea area1 =new TextArea(5,50);
         private TextArea area2 =new TextArea(5,50);
         private Button encriptar=new Button("encriptar");
         private Button decriptar=new Button("decriptar");
         public cuadro(){
              layoutApplet();
              encriptar.addActionListener(new ButtonHandler());
              decriptar.addActionListener(new ButtonHandler());
              resize(400,400);
              private void layoutApplet(){
              Panel keyPanel = new Panel();
              keyPanel.add(encriptar);
              keyPanel.add(decriptar);
              Panel textPanel = new Panel();
              Panel texto1 = new Panel();
              Panel texto2 = new Panel();
              texto1.add(new Label("               plain text"));
              texto1.add(area1);
              texto2.add(new Label("               cipher text"));
              texto2.add(area2);
              textPanel.setLayout(new GridLayout(2,1));
              textPanel.add(texto1);
              textPanel.add(texto2);
              setLayout(new BorderLayout());
              add("North", keyPanel);
              add("Center", textPanel);
              public static String encriptar(String text1){
              //generar una clave
              SecretKey clave=null;
              String text2="";
              try{
              FileOutputStream fs =new FileOutputStream ("c:/javasoft/ti.txt");
              DataOutputStream es= new DataOutputStream(fs);
                   for(int i=0;i<text1.length();++i){
                        int j=text1.charAt(i);
                        es.write(j);
                   es.close();
              }catch(IOException e){
                   System.out.println("no funciona escritura");
              }catch(SecurityException e){
                   System.out.println("el fichero existe pero es un directorio");
              try{
                   //existe archivo DESkey.ser?
                   ObjectInputStream claveFich =new ObjectInputStream(new FileInputStream ("DESKey.ser"));
                   clave = (SecretKey) claveFich.readObject();
                   claveFich.close();
              }catch(FileNotFoundException e){
                   System.out.println("creando DESkey.ser");
                   //si no, generar generar y guardar clave nueva
              try{
                   KeyGenerator claveGen = KeyGenerator.getInstance("DES");
                   clave= claveGen.generateKey();
                   ObjectOutputStream claveFich = new ObjectOutputStream(new FileOutputStream("DESKey.ser"));
                   claveFich.writeObject(clave);
                   claveFich.close();
              }catch(NoSuchAlgorithmException ex){
                   System.out.println("DES key Generator no encontrado.");
                   System.exit(0);
              }catch(IOException ex){
                   System.out.println("error al salvar la clave");
                   System.exit(0);
         }catch(Exception e){
              System.out.println("error leyendo clave");
              System.exit(0);
         //crear una cifra
         Cipher cifra = null;
         try{
              cifra= Cipher.getInstance("DES/ECB/PKCS5Padding");
              cifra.init(Cipher.ENCRYPT_MODE,clave);
         }catch(InvalidKeyException e){
              System.out.println("clave no valida");
              System.exit(0);
         }catch(Exception e){
              System.out.println("error creando cifra");
              System.exit(0);
         //leer y encriptar el archivo
         try{
              DataInputStream in = new DataInputStream(new FileInputStream("c:/javasoft/ti.txt"));
              CipherOutputStream out = new CipherOutputStream(new DataOutputStream(new FileOutputStream("c:/javasoft/t.txt")),cifra);
              int i;
              do{
                   i=in.read();
                   if(i!=-1) out.write(i);
              }while (i!=-1);
              in.close();
              out.close();
         }catch(IOException e){
              System.out.println("error en lectura y encriptacion");
              System.exit(0);
         try{
              FileInputStream fe=new FileInputStream("c:/javasoft/t.txt");
              DataInputStream le =new DataInputStream(fe);
                   int i;
                   char c;
                   do{
                        i=le.read();
                        c= (char)i;
                        if(i!=-1){
                        text2 += text2.valueOf(c);
                   }while(i!=-1);
                        le.close();
              /*}catch(FileNotFoundException e){
                   System.out.println("fichero no encontrado");
                   System.exit(0);
              }catch(ClassNotFoundException e){
                   System.out.println("clase no encontrada");
                   System.exit(0);
              */}catch(IOException e){
                   System.out.println("error e/s");
                   System.exit(0);
              return text2;
         class ButtonHandler implements ActionListener{
         public void actionPerformed(ActionEvent e){
              try{
              if (e.getActionCommand().equals(encriptar.getLabel()))
                   //     area2.setText(t1)
                   area2.setText(encriptar(area1.getText()));
                   //area2.setText("escribe algo");
                   else if (e.getActionCommand().equals(decriptar.getLabel()))
                        System.out.println("esto es decriptar");
                        //area2.setText("hola");
         }catch(Exception ex){
              System.out.println("error en motor de encriptacion");
                   //else System.out.println("no coge el boton encriptado/decript");

    If you don't require your code to run as an applet, you will probably get more mileage from refactoring it to run as an application.
    As sudha_mp implied, an unsigned applet will fail on the line
    FileInputStream fe=new FileInputStream("c:/javasoft/t.txt");
    due to security restrictions. (Which, incidentally, are there for a very good reason)

  • Help: commandLink does not work.

    commandLink does not work. It just simple refreshes the page, and not enter the Listener,( he listener work pretty well in other page).
    Is it dataTable problem? If I not use dataTable but just use JSTL & JSF commandLink and it works fine.
    --------------CODE---------------
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <link rel="stylesheet" type="text/css" href='<%= request.getContextPath() + "/style/styletable.css"%>'/>
    <f:loadBundle basename="bundle.admin.Attribute" var="bdlAttribute"/>
    <f:subview id="AttributeListView">
    <h:form id="AttributeListForm">
    <center>
    <h:outputText escape="false" value="Text Here"/>
    <br>
    <h:dataTable id="AttributeTable"
    columnClasses="list-column-center,list-column-right, list-column-center, list-column-right"
    headerClass="list-header"
    rowClasses="list-row"
    styleClass="list-background"
    value="#{list}"
    var="attribute">
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.TitleList}"/>
    </f:facet>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Category}"/>
    </f:facet>
    <h:outputText id="category" value="#{attribute.category}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Value}"/>
    </f:facet>
    <h:outputText id="value"
    value="#{attribute.value}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.DataType}"/>
    </f:facet>
    <h:outputText id="dataType" value="#{attribute.dataType}">
    </h:outputText>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Edit}" />
    </f:facet>
              <h:commandLink action="#{Action.action}" styleClass="link">
                   <f:actionListener type="my.AttributeListener"/>
                   <h:outputText value="Edit"/>
                   <f:param name="ID" value="#{attribute.attributeId}"/>
                   <f:attribute name="COMMAND" value="getAttribute"/>
              </h:commandLink>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="#{bdlAttribute.Delete}"/>
    </f:facet>
         <h:commandLink action="#{Action.action}" styleClass="link">
              <f:actionListener type="my.AttributeListener"/>
              <h:outputText value="Delete"/>
              <f:param name="ID" value="#{attribute.attributeId}"/>
              <f:attribute name="COMMAND" value="deleteAttribute"/>
         </h:commandLink>
    </h:column>
    </h:dataTable>
    <h:messages styleClass="validationMessage"/>
    </center>
    </h:form>
    </f:subview>

    Hi,
    I was casually reading your code and noticed the line:'
    <h:commandLink action="#{Action.action}" styleClass="link">
    I recall from other posts that if you want the method on the bean (of the clicked/ selected row) to be called, you probably need:
    <h:commandLink action="#{attribute.action}" styleClass="link">
    Ofcourse you would need to have a method called action in the class of instance "attribute". This method should return string for navigation etc.
    Looking at your code again:
    <h:commandLink action="#{Action.action}" styleClass="link">
    <f:actionListener type="my.AttributeListener"/>
    <h:outputText value="Delete"/>
    <f:param name="ID" value="#{attribute.attributeId}"/>
    <f:attribute name="COMMAND" value="deleteAttribute"/>
    </h:commandLink>
    I don't understand why you need:
    <f:actionListener type="my.AttributeListener"/>
    As I am not coding a lot of JSF I am only answering from what I have read.
    All the best,
    Vinay

  • SetScrollOffset(0) does not work with Plugin

    I have some JTextField's that are a certain length but can have longer text put into them. Initially when this happened you would only see the right side of the text. Adding the setScrollOffset(0) made the text left aligned when it was displayed.
    I have now converted over to using the Plugin (ver 1.3.1)
    and this does not work.
    Any suggestions would be appreciated.
    Thanks.

    I have solved this problem.
    I found another posting to use setCaretPosition(0)
    and this worked

  • 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...

  • Jump and Skip does not work

    I have written a program that executes certain instructions.It reads these instruction from an array of Textfield.I have a for loop to go through the Textfield.I am unable to implement a JUMP instruction that will jump to a specified Textfield as well as the SKIP instruction that will skip the next Textfield based on some condition.
    I tried the code below but it does not work
    private class Executionionhandler implements ActionListener
    { public void actionPerformed(ActionEvent event)
    { int StartLocation=(int)(Integer.parseInt(start2.getText()));
    //start1.setVisible(false);
    //start2.setVisible(false);
    //r, StartLocation, End, Stop are global
    for(int r=StartLocation;r<End && Stop==false;r++)
    {/content[r] is a Textfield
    String read=Content[r].getText();
    String com1=read.substring(0,2);
    int com11=(int)(Integer.parseInt(com1));
    String com2=read.substring(2,4);
    instruction(com11,com2);
    public void instruction(int IN1,String IN2)
    { switch(IN1)
    { case 1:
    //do something
    break;
    case 3:
    //do something break;
    case 7://the JUMP INSTRUCTION
    int JmpLoc7=(int)(Integer.parseInt(IN2));
    r=JmpLoc7;
    //StartLocation=JmpLoc7;
    break;
    case 8://the SKIP INSTRUCTION
    int copy81=(int)(Integer.parseInt(BUTTON.getText()));
    if(((copy81<0) && (IN2.equals("00"))) ||
    ((copy81==0) && (IN2.equals("01"))) ||
    ((copy81>0) && IN2.equals("02")))
    r++;
    case 11:
    error1.setText("End of command");
    Stop=true;
    break;
    default:
    error1.setText("BAD COMMAND");
    Stop=true;
    Any idea why or how can I achieve this?

    Hi,
    Not exactly sure what you code is trying to do and you didn't explain it either ...
    Some thoughts that might help:
    The variable r is only valid inside the for loop. Therefore setting it in another method will result in nothing happening. You will need to make r a class variable (like your comment says) to have access to a single variable in more than one method. Then you need to stop declaring it inside your for loop otherwise you will just create a local variable and all will be lost again.
    Something like:
    private class Executionionhandler implements ActionListener
      public void actionPerformed(ActionEvent event)
        for( r = StartLocation; r < End; ++r )
          instruction();
    }Regards,
    Manfred.

  • Program does not Work

    I have a for loop in which I am reading the content of an array.Also a method is called within the for loop the purpose of this method is to be able to jump to a another array index.
    I have written the program as shown below but it does not work.
    private class Executionionhandler implements ActionListener
    { public void actionPerformed(ActionEvent event)
    { for(int i=0;i<62;i++)
    { int x=array[i];
    int k=x+2;
    look(x);
    public void look(int j)
    { if(j==0)
    button.setText(�Readyl�);
    else if(j=1)
    button.setText(�Go�);
    else if(j=2)
    button.setText(�Stop�);
    else if(j==5)
    i=20;
    else button.setText(�Successful�);
    Any idea why or how can I achieve this?

    http://forum.java.sun.com/thread.jsp?thread=265406&forum=31&message=1006380
    http://forum.java.sun.com/thread.jsp?thread=265328&forum=31&message=1006048
    http://forum.java.sun.com/thread.jsp?thread=265310&forum=31&message=1005982
    http://forum.java.sun.com/thread.jsp?thread=265307&forum=31&message=1005979
    http://forum.java.sun.com/thread.jsp?thread=265307&forum=31&message=1005969

  • Copy/Paste worked in JDK 1.4 and does not work more for Java 1.4.1_01

    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 regards

    Hi,
    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

  • Application is fine in prompt line but in the JSW does not work

    Hi folks
    I have a stuck problem with my application. It works fine with java ... but does not work with the javaws! The problem is in a inner class who extends a panel which must be painted several times (the application works with a optimazation traffic algorithm)... If i use the inner class, the program does not appear and there is no bug messages.
    If a cut the lines with the drawingPane code, the application run without a problem with the javaws!
    These are the important lines of the code:
    // Main class
    public class AlgConstrutivos extends JPanel
    implements MouseListener, ActionListener{
    // The problem PANEL!!!!!!!!!!
    private JPanel drawingPane;
    // The constructor of main class
    public AlgConstrutivos() {
    drawingPane = new DrawingPane();
    drawingPane.setBackground(Color.white);
    drawingPane.addMouseListener(this);
    //Put the drawing area in a scroll pane.
    JScrollPane scroller = new JScrollPane(drawingPane);
    scroller.setPreferredSize(new Dimension(400,400));
    //Lay out
    add(ordem, BorderLayout.PAGE_START);
    add(scroller, BorderLayout.CENTER);
    // The main function
    public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    JComponent newContentPane = new AlgConstrutivos();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public class DrawingPane extends JPanel {
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    // Draw some lines and points...
    Any help?
    Thanks...
    Andre Cordenonsi

    Yes... In fact, the inner class is in the same .java file...
    There are no error messages at all!
    My jnpl file is (i run with --> javaws a.jnpl)
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+"
    codebase="file:///c:/animacao/" href="a.jnlp"
    >
    <information>
    <title>ARGH!</title>
    <vendor>Myself</vendor>
    <homepage href="/animacao" />
    <description>...</description>
    </information>
    <offline-allowed/>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.2+" />
    <jar href="Teste.jar"/>
    <nativelib href="Teste.jar"/>
    </resources>
    <application-desc main-class="AlgConstrutivos" />
    </jnlp>
    I try use the nativelib resource, but nothing happens...
    Andre Cordenonsi

  • Programmatically clearing an input item does not work

    Hello,
    I want to clear one input item (RichInputListOfValues) contained in a PanelForm programmatically, after the user presses on the "Clear" button:
    <af:commandToolbarButton text="Clear" id="ctb1"
    actionListener="#{pageFlowScope.UiBindings.clearItem}"/>Where the code that should really clear the item is:
        public void clearItem(ActionEvent actionEvent) {
                getItem().setValue(null);
                // getItem().resetValue(); // even with this, it does not work.
                AdfFacesContext.getCurrentInstance().addPartialTarget(getItem());
        public RichInputListOfValues getItem() {
            return item;
        }However, the above does not clear the item on the page. I have to click a second time to actually see the item empty as expected.
    The problem still appears if I also do addPartialTarget() on the PanelForm container.
    Do you have any idea?

    My test case:
    JDeveloper 11.1.2.2
    page:
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
        <af:document title="untitled1.jsf" id="d1">
            <af:form id="f1">
                <af:toolbar id="t1">
                    <af:commandToolbarButton text="Clear" id="ctb1" actionListener="#{viewScope.myBean.clear}"/>
                </af:toolbar>
                <af:inputListOfValues label="Label 1" popupTitle="Search and Result Dialog" id="ilov1"
                                      binding="#{viewScope.myBean.item}"/>
            </af:form>
        </af:document>
    </f:view>bean:
    package view;
    import javax.faces.event.ActionEvent;
    import oracle.adf.view.rich.component.rich.input.RichInputListOfValues;
    import oracle.adf.view.rich.context.AdfFacesContext;
    public class myBean
      private RichInputListOfValues item;
      public myBean()
      public void setItem(RichInputListOfValues item)
        this.item = item;
      public RichInputListOfValues getItem()
        return item;
      public void clear(ActionEvent actionEvent)
        getItem().setValue(null);
        AdfFacesContext.getCurrentInstance().addPartialTarget(getItem());
    }config:
    <?xml version="1.0" encoding="windows-1252" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
      <managed-bean id="__1">
        <managed-bean-name>myBean</managed-bean-name>
        <managed-bean-class>view.myBean</managed-bean-class>
        <managed-bean-scope>view</managed-bean-scope>
      </managed-bean>
    </adfc-config>It works fine on the first click. Something's not right on your end :)
    John

  • Cancel button does not work properly in ProgressMonitor

    The cancel button does not work properly in my ProgressMonitor.
    Only the keyboard Enter key is accepted but no mouse click.
    Everything else works fine.
    What could be wrong????
    Thank you!

    Yes, there is a monitor.isCanceled() and it works if the enter key is pressed. However, a mouse click on the cancel button does not work!!!
    Please help.
    m_btnSave.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
              final int maximum = getMyModel().getList(MerchantHierPropagateMgrDataInterface.ATT_MAN_RESULT).size();
              class TimerListener implements ActionListener {
                   public void actionPerformed(ActionEvent evt) {
                        System.out.println("*************isCanceled = "+ m_monitor.isCanceled());
                        if (m_monitor.isCanceled() || getMyModel().isDone()) {
                             m_timer.stop();
                             m_monitor.close();
                             if (getMyModel().isDone()) {
                                  m_ok = true;
                                  close();
                             else {
                                  m_worker.interrupt();
                                  try {
                                       m_pm.rollback();
                                  } catch (SQLException e) {
                                       BPrompter.showException(e);
                                       Log.printOutAlways(e);
                        else {
                             int progress = getMyModel().getProgess();
                             int prozent = maximum == 0 ? 0 : 100 * progress / maximum ;
                             m_monitor.setProgress(progress);
                             m_monitor.setNote("Fertigstellung: (" + prozent + "%) " + progress + " von " + maximum);
              if (getModel().getList(MerchantHierPropagateMgrDataInterface.ATT_MAN_RESULT).size() > 100) {
                   if (BPrompter.showConfirmDialog("Diese Funktion kann mehrere Minuten dauern.", "Hinweis") != JOptionPane.OK_OPTION) {
                        return;
              m_monitor = new ProgressMonitor(FrameApplication.getInstance(), "Fortschritt der Weitergabe",
                        "Initialisierung", 1, maximum);
              m_monitor.setMillisToDecideToPopup(0);
              m_monitor.setMillisToPopup(0);
              m_timer = new Timer(500, new TimerListener());
              m_timer.start();
              m_worker = new SwingWorker() {
                   public Object construct() {
                        try {
                             getMyModel().propagateToMerchantsAndTerminals(m_pm,     m_mutationInZukunftZuErledigenBisDate);
                        } catch (PersistenceException e) {
                             Log.printOutAlways(e);
                             return e;
                        return Boolean.TRUE;
                   } // constuct()
              }; // SwingWorker
              m_worker.start();
    });

  • 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?
    Ron

    I 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

Maybe you are looking for

  • Any way to find out where most of the memory is being taken up?

    I've got a G4 Tower with the latest 10.5 OS. I have an 80 GB drive, with 19 GB remaining. Single clicking on Mac HD, then "apple i" shows me this. Is there any way to find out more specifically where most of the memory is being taken up? Say, what fo

  • Creation of table space in SQLPlus

    How to create a tablespace thro' SQLPlus (command) - Using 10gR2 on windows Thax Shabar

  • File Sender channel stopped polling on FTP site

    Dear all, We have many file to Idoc interfaces running in production and all are they good. Yesterday we faced one issue, one of the interface's sender communication channel stopped polling and didn't picked the files from FTP. There was no error on

  • How to set a dynamic validation message in javascript

    Hi, I am using the "validate" event on a field, along with the "script message" field, to make a validation and send a message to the user if the test fails. - Is it possible to define parameters in this message, for example "field &1 is invalid" whe

  • How to transport number range group Configuration in Material Master

    Hi, I have this query regarding how to transport number range group in material master from one server to another. Problem: There was no number range assignment done for a particular material type. So, i assigned the particular mat. type to a group w