Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8210738

The type javax.swing.JComponent cannot be resolved. It is indirectly referenced

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      System : Windows 10 64 bit system
      Java : JDK1.8u181
      Build tool : apache ant
      IDE : NA

      A DESCRIPTION OF THE PROBLEM :
      I am building my application using ant . Each time I try to build the code I am getting below mentioned error :

      "The type javax.swing.JComponent cannot be resolved. It is indirectly referenced from required .class files"

      One main thing to notice regarding this error is that when I am using JDK 1.7.0.25 to build the application then I am not facing any such issue and code is compiled successfully but I case of JDK 1.8u181 I am getting above mentioned error.
       

      REGRESSION : Last worked in version 8u181


      ---------- BEGIN SOURCE ----------
      /**
       * Copyright (c) 2001-2005 Iris Financial Engineering. All Rights Reserved.
       *
       * THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
       * BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
       * IRIS FINANCIAL ENGINEERING.
       */
      package com.iris.csl.client;

      import java.awt.BorderLayout;
      import java.awt.Component;
      import java.awt.Cursor;
      import java.awt.Dimension;
      import java.awt.FlowLayout;
      import java.awt.GridLayout;
      import java.awt.Rectangle;
      import java.awt.Toolkit;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.event.MouseAdapter;
      import java.awt.event.MouseEvent;

      import javax.swing.ImageIcon;
      import javax.swing.JButton;
      import javax.swing.JLabel;
      import javax.swing.JPanel;
      import javax.swing.JPasswordField;
      import javax.swing.JTextField;
      import javax.swing.WindowConstants;

      import com.iris.foundation.gui.grid.properties.GridStringResources;
      import com.iris.foundation.gui.util.DefaultSetter;

      /**
       * Login dialog main class.
       */
      public class LoginDialog extends javax.swing.JFrame
      {
          /**
           * Constructor.
           */
          public LoginDialog()
          {
              super("temp title");
              init();
          }

          /** Action name for OK button. */
          public static final String sOkButtonActionCommand = "PROCESS_LOGIN_OK";
          /** Action name for Cancel button. */
          public static final String sCancelButtonActionCommand = "PROCESS_LOGIN_CANCEL";

          /**
           * Reset the dialog and clear out any current entries.
           */
          public void reset()
          {
              mLoginDetail.reset();
          }

          /**
           * Get the dialog title.
           * @return the dialog title
           */
          public String getTitle()
          {
              return GridStringResources.getString("IRIS_CSL_LOGIN");
          }

          /**
           * Get the user name entered in this dialog.
           * @return user name or null if no user name has been added
           */
          public String getUserName()
          {
              String userName = mLoginDetail.getUserName();

              if (userName != null && userName.length() == 0)
              {
              userName = null;
              }

              return userName;
          }

          /**
           * Get the password entered in this dialog.
           * @return the password or null if no password entered
           */
          public String getPassword()
          {

              String password = mLoginDetail.getPassword();

              if (password != null && password.length() == 0)
              {
                  password = null;
              }

              return password;
          }

          /**
           * Returns the URL of the app server.
           * @return the URL of the app server or null if not specified
           */
          public String getURL()
          {
              return mLoginDetail.getURL();
          }

          /**
           * Set the component state to busy/not-busy.
           * @param state true if busy
           */
          public void setBusy(boolean state)
          {
              getGlassPane().setVisible(state);
              validate();
              repaint();

          }

          /**
           * Set the default app server URL to be displayed initially.
           * @param url the default URL string
           */
          public void setDefaultURL(String url)
          {
              mLoginDetail.setURL(url);
          }

          /**
           * Set the default user name to be displayed initially.
           * @param userName the default user name string
           */
          public void setDefaultUser(String userName)
          {
              mLoginDetail.setUserName(userName);
          }

          /**
           * Set the default password to be displayed initially.
           * @param password the default password string
           */
          public void setDefaultPassword(String password)
          {
              mLoginDetail.setPassword(password);
          }

          /**
           * Add an ActionListener to the OK/Cancel buttons.
           * @param actionListener the action listener to add
           * @see #removeActionListener
           */
          public void addActionListener(ActionListener actionListener)
          {
              if (actionListener != null)
              {
                  mOkButton.addActionListener(actionListener);
                  mCancelButton.addActionListener(actionListener);
              }
          }

          /**
           * Remove an ActionListener to the OK/Cancel buttons.
           * @param actionListener the action listener to remove
           * @see #addActionListener
           */
          public void removeActionListener(ActionListener actionListener)
          {
              if (actionListener != null)
              {
                  mOkButton.removeActionListener(actionListener);
                  mCancelButton.removeActionListener(actionListener);
              }
          }

          /**
           * Show the dialog.
           */
          public void show ()
          {
              //Center the window
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              Dimension frameSize = getSize();
              if (frameSize.height > screenSize.height) {
                  frameSize.height = screenSize.height;
              }
              if (frameSize.width > screenSize.width) {
                  frameSize.width = screenSize.width;
              }

              setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);

              super.show();
              toFront();
              mLoginDetail.requestFocus();
          }

          /**
           * Creates and lays out the components inside the login dialog.
           */
          private void init()
          {
              setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
              setResizable (false);

              getContentPane().setLayout(mBorder1);

              setSize(400, 200);

              mLoginDetail.setPreferredSize(new Dimension(270, 120));
              mLoginDetail.setOpaque(false);

              mOkButton.setText(GridStringResources.getString("GRID_OK"));
              mOkButton.setActionCommand(sOkButtonActionCommand);
              mOkButton.setBounds(new Rectangle(10, 113, 92, 25));
              mOkButton.setSelected(true);

              mCancelButton.setText(GridStringResources.getString("GRID_CANCEL"));
              mCancelButton.setActionCommand(sCancelButtonActionCommand);
              mCancelButton.setBounds(new Rectangle(10, 147, 92, 25));

              mButtonHolder.setPreferredSize(new Dimension(120, 50));
              FlowLayout buttonLayout = new FlowLayout();
              buttonLayout.setHgap(30);
              buttonLayout.setAlignment(FlowLayout.CENTER);

              mButtonHolder.setLayout(buttonLayout);
              mButtonHolder.add(mOkButton, null);
              mButtonHolder.add(mCancelButton, null);
              mButtonHolder.setOpaque(false);

              createGlassPane();

              JPanel iconPanel = new JPanel ();
              BorderLayout iconLayout = new BorderLayout();
              iconPanel.setLayout(iconLayout);
              ImageIcon logo = new ImageIcon(getClass().getResource("iris_logo.gif"));
              JLabel iconLabel = new JLabel (logo);
              setIconImage(logo.getImage());
              iconPanel.add(iconLabel, BorderLayout.CENTER);

              getContentPane().add(mButtonHolder, BorderLayout.SOUTH);
              getContentPane().add(mLoginDetail, BorderLayout.EAST);
              getContentPane().add(iconPanel, BorderLayout.CENTER);

              //SPR 8371 Added default button.
              DefaultSetter.setupDefaults(this, mOkButton, mCancelButton );

              repaint();
          }

          /**
           * Called internally to create the glass pane for this top level component
           */
          private void createGlassPane()
          {
              Component glass = getGlassPane();

              glass.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

              glass.addMouseListener(
                  new MouseAdapter()
                  {
                      public void mousePressed(MouseEvent e)
                      {
                          // I think this is a dummy listener that ensures the class panel handles mouse events.
                      }
                  });
          }


          /**
           * class to implement the login details panel
           */
          private static class LoginDetailsPanel extends javax.swing.JPanel
          {
              /**
               * Constructor
               */
              public LoginDetailsPanel()
              {
                  GridLayout layout = new GridLayout ();
                  layout.setColumns(1);
                  layout.setRows(3);

                  setLayout(layout);

                  add (createTextFieldPanel(GridStringResources.getString("LOGIN_USER"), mUserNameField), null);
                  mUserNameField.selectAll();
                  add (createTextFieldPanel(GridStringResources.getString("LOGIN_PASSWORD"), mPasswordField), null);
                  add (createTextFieldPanel(GridStringResources.getString("LOGIN_SERVER_URL"), mURLField), null);
              }

              /**
               * Clear out fields in this component
               */
              public void reset()
              {
                  mUserNameField.setText("");
                  mPasswordField.setText("");
                  // mURLField.setText("");
                  mUserNameField.requestFocus();
              }

              /**
               * This implementation will move the keyboard focus onto the user name field.
               */
              public void requestFocus()
              {
                  // delegate to user name
                  mUserNameField.requestFocus();
              }

              /**
               * get the username entered by the user.
               * @return user name string as entered
               */
              public String getUserName()
              {
              return mUserNameField.getText();
              }

              /**
               * set the user name
               * @param userName name to set
               */
              public void setUserName (String userName)
              {
                  mUserNameField.setText (userName);
              }

              /**
               * get the password entered by the user.
               * @return password string as entered
               */
              public String getPassword()
              {
                  char[] password = mPasswordField.getPassword();
                  return new String (password);
              }

              /**
               * set the password
               * @param password password to set
               */
              public void setPassword (String password)
              {
                  mPasswordField.setText (password);
              }

              /**
               * get the app server URL entered by the user.
               * @return URL string as entered.
               */
              public String getURL()
              {
                  return mURLField.getText();
              }

              /**
               * set the url string.
               * @param url to set.
               */
              public void setURL (String url)
              {
                  mURLField.setText (url);
              }

              /**
               * Create a text panel.
               * @param labelString the label next to text input field
               * @param textField The text input field.
               * @return the created panel.
               */
              private JPanel createTextFieldPanel(String labelString, JTextField textField)
              {
                  FlowLayout layout = new FlowLayout();
                  layout.setHgap(15);
                  layout.setAlignment(FlowLayout.RIGHT);

                  JPanel panel = new JPanel();
                  panel.setLayout(layout);
                  panel.setOpaque(false);

                  textField.setPreferredSize(new Dimension(150, 20));

                  JLabel label = new JLabel();
                  label.setText(labelString);

                  panel.add(label, null);
                  panel.add(textField, null);

                  return panel;

              }

              /** Input text field for the user name. */
              private JTextField mUserNameField = new JTextField();
              /** Input text field for the password. */
              private JPasswordField mPasswordField = new JPasswordField();
              /** Input text field for URL to the server. */
              private JTextField mURLField = new JTextField();
          }

          // end of Login details inner class

          /** Panel of buttons. */
          private JPanel mButtonHolder = new JPanel();
          /** OK button - logs in the user. */
          private JButton mOkButton = new JButton();
          /** cancel button - exists. */
          private JButton mCancelButton = new JButton();

          /** Panel containing the input test fields. */
          private LoginDetailsPanel mLoginDetail = new LoginDetailsPanel();

          /** Border layout around the dialog. */
          private BorderLayout mBorder1 = new BorderLayout();

          /**
           * Main for testing purposes.
           * @param args none currently used
           */
          public static void main (String[] args)
          {
              // testing
              LoginDialog d = new LoginDialog ();
              d.addActionListener(new TestLoginActionListener(d));
              d.setDefaultUser("sc");
              d.setDefaultURL("t3://localhost:9001");

              d.show();

              System.out.println ("finished");
          }

          /** Listener on the login dialog for testing purposes. */
          private static class TestLoginActionListener implements ActionListener
          {
              /**
               * Create listener on the login dialog for testing purposes.
               * @param dialog The login dialog to listen to.
               */
              TestLoginActionListener (LoginDialog dialog)
              {
                  mDialog = dialog;
              }

              /**
               * Callback invoked then the user performs an action on the login dialogue.
               * @param e The event that contains information about the event.
               */
              public void actionPerformed(ActionEvent e)
              {
                  System.out.println ("cmd = " + e.getActionCommand());
                  if (e.getActionCommand() == sOkButtonActionCommand)
                  {
                      System.out.println ("OK pressed");
                      System.out.println ("userName = " + mDialog.getUserName());
                      System.out.println ("password = " + mDialog.getPassword());
                      System.out.println ("URL = " + mDialog.getURL());
                  }
                  else if (e.getActionCommand() == sCancelButtonActionCommand)
                  {
                      System.out.println ("Cancel pressed");
                      System.exit(-1);

                  }

              }

              /** The login dialogue we are listening to. */
              private LoginDialog mDialog;
          }
      }

      /**
       * $Log: LoginDialog.java,v $
       * Revision 1.11.2.1 2005/08/08 08:00:24 tolukemi
       * SPR 16334: Internationalization changes
       *
       * Revision 1.11 2005/03/30 14:52:40 dtran
       * SPR 14536 Merge CSA 2.2 build 14 through CSA 2.3 and CSA 2.4 into main line.
       *
       * Revision 1.10.6.1 2005/03/30 13:06:38 dtran
       * SPR 14535 Merge CSA 2.2 build 14 through CSA 2.3 into CSA 2.4.
       *
       * Revision 1.10.2.2 2005/03/30 11:13:11 dtran
       * SPR 14534 Merge changes made on CSA 2.2 branch between build 13 and build 14 onto CSA 2.3 branch.
       *
       * Revision 1.10.2.1 2005/03/02 10:07:57 dtran
       * SPR 14062. Check in transparent logo with the correct size.
       * Javadoc and layout clean up.
       *
       * Revision 1.10 2004/10/04 13:34:14 csldev
       * SPR 12033 CSA 22 merged into CSA 23
       *
       * Revision 1.9.10.2 2005/02/28 16:34:16 dtran
       * SPR 10229. Remove unnecessary addKeyListener - handled by DefaultSetter.
       *
       * Revision 1.9.10.1 2004/10/01 16:34:59 dtran
       * SPR 10751 Replace Iris logo
       *
       * Revision 1.9 2004/05/27 15:11:50 btung
       * SPR 8371 Added default OK button behaviour.
       *
       * Revision 1.8 2003/04/23 10:29:12 huw
       * SPR 4908 Fix up log lines
       *
       * Revision 1.7 2003/04/22 14:05:20 huw
       * SPR 4908
       *
       * Revision 1.6 2002/12/10 18:29:02 csldev
       * SPR 2758 Merge csa10_branch changes into mainline
       *
       * Revision 1.5 2002/11/15 19:44:48 jangeles
       * SPR 2599 - Documentation updates - merged from csa10_branch
       *
       * Revision 1.4 2002/11/14 00:53:01 jangeles
       * SPR 2599 - Documentation updates
       *
       * Revision 1.3 2002/09/27 17:24:48 scolwill
       * branches: 1.3.6;
       * SPR 2226 - stop initial context being cached when login fails and re-attempted
       *
       * Revision 1.2 2001/12/20 10:28:49 dtran
       * branches: 1.2.2;
       * SPR 777. Add copyright notice.
       *
       * Revision 1.1 2001/11/12 15:10:50 jn
       * SPR 683
       * Make the swing client manager more usuable
       *
       * Revision 1.2.2.1 2002/03/06 18:35:58 alanm
       * SPR 968
       * Change title in jdemo branch from CSL to CSA.
       *
       * Revision 1.3.6.4 2002/12/05 01:18:55 jangeles
       * SPR 2599 - Documentation updates
       *
       * Revision 1.3.6.3 2002/11/15 19:28:53 jangeles
       * SPR 2599 - Documentation updates
       *
       * Revision 1.3.6.2 2002/11/13 01:05:07 jangeles
       * SPR 2599 - Documentation updates
       *
       * Revision 1.3.6.1 2002/11/13 00:58:33 jangeles
       * SPR 2599 - Documentation updates
       */

      ---------- END SOURCE ----------

      FREQUENCY : always


            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: