Problem using extended JPanel

Hi, I'm using JDeveloper 10.1.3.3. I've extended JPanel and named it TestPanel, and then have added few textboxes, one checkbox and one combobox. It was created as runnable panel. When I run that panel, everything worked fine. I used it in custom JFrame instead of dataPanel:
TestPanel dataPanel = new TestPanel();
Whatever I did, I couldn't see components on that custom panel. I tried to rebuild, run frame, I couldn't see it.
Then I've tried to create another panel in original dataPanel (JPanel, BorderLayout), and use TestPanel that way. Didn't work. Does anyone know what might be the problem?

Colleague helped me.
Created custom panel is placed in Components View as ADF Swing Regions -> view.TestPanel, so it can be dragged and dropped.
If creating panel in code, after creating custom JPanel
TestPanel dataPanel = new TestPanel();
There must be this line in jbInit() method:
testPanel1.bindNestedContainer(panelBinding.findNestedPanelBinding("TestPanelPageDef1"));

Similar Messages

  • Extending JPanel to contain a JRootPane - problems with scroll panes

    I am trying to write a JPanel subclass that contains a JRootPane, similar to the way that JFrame contains a JRootPane. The reason that I am doing this is that I would like to be able to intercept mouse events using the JGlassPane facility, but adding the glasspane to the JFrame is problematic since it then intercepts mouse events over all components in the JFrame, including the menu bar. It seems simpler to me to have the JRootPane owned by a JPanel, to give me better control over intercepting events. I've got an implementation working with the JFrame case, but have had to handle many small "gotchas", and at least one more exists. I'm hoping to simplify things by moving away from this way of doing things.
    I wrote a straightforward RootPanePanel class that extends JPanel and implements RootPaneContainer, delegating all of the add methods to the JRootPane's content pane. Here's the constructor for RootPanePanel:
    public RootPanePanel (LayoutManager layout) {
            rootPane = new JRootPane ();
            rootPane.setOpaque(true);
            rootPane.getContentPane().setLayout(layout);
            super.add (rootPane);
    }RootPanePanel also delegates calls like getContentPane/setContentPane to the JRootPane.
    To test my implementation, I wrote a main method that looks like the following:
    public static void main (String[] args) {
      SwingUtilities.invokeLater(new Runnable () {
        public void run () {
          try {
            JEditorPane editorPane = new JEditorPane ("http://www.archives.gov/exhibits/charters/print_friendly.html?page=declaration_transcript_content.html&title=NARA%20%7C%20The%20Declaration%20of%20Independence%3A%20A%20Transcription");
            JScrollPane scrollPane = new JScrollPane (editorPane);
            JFrame frame = new JFrame ("Test RootPanePanel");
            RootPanePanel panel = new RootPanePanel ();                    
            panel.add(scrollPane);
            frame.add(panel, BorderLayout.CENTER);
            scrollPane.setPreferredSize(new Dimension(800, 600));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize (640, 480);
            frame.pack ();
            frame.setVisible(true);
          } catch (Exception e) {
            e.printStackTrace();
      });Note that I'm not actually using JEditorPane in my application, but it is the simplest component that displays the problem I'm encountering.
    When this code runs, it is fine, as long as the JFrame is big enough to display the scrollbars for the JScrollPane. If the JFrame is made small enough, the scrollbars are not displayed.
    If I instead add the JScrollPane to the JFrame directly, it behaves as you would expect.
    Is this a problem of mixing heavyweight and lightweight components? It doesn't seem like it should be; in both cases the JScrollPane is handling the same client component, the JEditorPane.
    Any suggestions/ideas are welcome!

    Here's the full RootPanePanel class in case people want to try it out
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.HeadlessException;
    import java.awt.LayoutManager;
    import java.io.IOException;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    import javax.swing.JLayeredPane;
    import javax.swing.JPanel;
    import javax.swing.JRootPane;
    import javax.swing.JScrollPane;
    import javax.swing.RootPaneContainer;
    import javax.swing.SwingUtilities;
    public class RootPanePanel extends JPanel implements RootPaneContainer {
         private JRootPane rootPane;
         public RootPanePanel () {
              this (new BorderLayout());
         public RootPanePanel (LayoutManager layout) {
              rootPane = new JRootPane ();
              rootPane.setOpaque(true);
              rootPane.getContentPane().setLayout(layout);
              super.add (rootPane);
         public Container getContentPane() {
              return rootPane.getContentPane();
         public Component getGlassPane() {
              return rootPane.getGlassPane();
         public JLayeredPane getLayeredPane() {
              return rootPane.getLayeredPane();
         public void setContentPane(Container arg0) {
              rootPane.setContentPane(arg0);
         public void setGlassPane(Component arg0) {
              rootPane.setGlassPane(arg0);
         public void setLayeredPane(JLayeredPane arg0) {
              rootPane.setLayeredPane(arg0);
         @Override
         protected void addImpl(Component comp, Object constraints, int index)
              if (comp == rootPane) {
                   super.addImpl(comp, constraints, index);
              else {
                   getContentPane().add(comp, constraints, index);
         @Override
         public Component add(Component comp, int index) {
              return rootPane.getContentPane().add(comp, index);
         @Override
         public void add(Component comp, Object constraints, int index) {
              rootPane.getContentPane().add(comp, constraints, index);
         @Override
         public void add(Component comp, Object constraints) {
              rootPane.getContentPane().add(comp, constraints);
         @Override
         public Component add(Component comp) {
              return rootPane.getContentPane().add(comp);
         @Override
         public Component add(String name, Component comp) {
              return rootPane.getContentPane().add(name, comp);
         public static void main (String[] args) {
              SwingUtilities.invokeLater(new Runnable () {
                   public void run () {
                        try {
                             JEditorPane editorPane = new JEditorPane ("http://www.archives.gov/exhibits/charters/print_friendly.html?page=declaration_transcript_content.html&title=NARA%20%7C%20The%20Declaration%20of%20Independence%3A%20A%20Transcription");
                             JScrollPane scrollPane = new JScrollPane (editorPane);
                             JFrame frame = new JFrame ("Test RootPanePanel");
                             RootPanePanel panel = new RootPanePanel ();                    
                             panel.add(scrollPane);
                             frame.add(panel, BorderLayout.CENTER);
                             scrollPane.setPreferredSize(new Dimension(800, 600));                                                                                                                                                 
                             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                             frame.setSize (640, 480);
                             frame.pack ();
                             frame.setVisible(true);                                                                                                    
                        } catch (HeadlessException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                        } catch (IOException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
         public JRootPane getRootPane() {
              return rootPane;
    }

  • Problem extending JPanel

    Hi,
    What is the best format to have a class with a JFrame and a number of JPanels, one of which needs to be painted on using Graphics.
    class Demo extends JPanel{
    public JFrame frame;
    public JPanel panel1;
    public JPanel panel2;
    public JPanel panel3;
       Demo(){
          // initialise JFrame
          frame = new JFrame();
          // initialise a few JPanels
          panel1 = new JPanel();
          panel2 = new JPanel();
          panel3 = new JPanel();
          // refer to the JPanel I'm painting on
          frame.getContentPane(this);   // Is this correct?
         public void paint(Graphics g)     {
              g.drawString("Click below", 50, 50);               
                  // now this method should paint over one of the JPanels only, the one I'm extending..
    }Any thought appreciated.

    Thanks for the pointers Haynese ,
    I understand what I should be doing.
    I have another issue with this now, maybe its constructed badly...
    I can get the graphics objects on the JPanel to display but not the JButton or label I add. If I click in the region of the button and hit it, it appears. Any ideas?
    public class GraphEditor extends JPanel implements MouseListener
    public JButton button;
    public JLabel label5;
         public GraphEditor(){
              //  JPanel Button, displays if clicked on.
              button = new JButton("JPanel Button, displays if clicked on...");
              this.add(button);
                                             //  This should display but never does
              label5 = new JLabel("This should display but never does");
              add(label5);
              setSize(50,50);
              setVisible(true);
         public void paint(Graphics g)     {
                                            // This displays fine
              g.drawString("This displays fine", 5, 5);               
    }and:
    public class SystemWindow extends JFrame {     
    public JButton button;
    public JPanel topPanel;
    public JPanel bottomPanel;
    public JPanel mainPanel;
    public JLabel topPanelLabel;
    public JLabel bottomPanelLabel;
    public JButton getPathButton;
    private GraphEditor mainMap = new GraphEditor(this);
         SystemWindow(){     
             topPanel = new JPanel();
              bottomPanel = new JPanel();
              mainPanel = new JPanel();
              // 10 is horizontal
                                               // 01 is vertical
              getContentPane().setLayout(new GridLayout(0,1));
              getContentPane().add(mainPanel);
              mainPanel.add(topPanel);
              mainPanel.add(bottomPanel);
              topPanelLabel = new JLabel("Top Panel");
              topPanel.add(topPanelLabel);
              bottomPanelLabel = new JLabel("Bottom Panel");
              bottomPanel.add(bottomPanelLabel);
              button = new JButton("Save");
              //button.addActionListener(this);
              bottomPanel.add(button);
              getPathButton = new JButton("Get");
              //getPathButton.addActionListener(this);
              bottomPanel.add(getPathButton);
              getContentPane().add(mainMap);
              setTitle("App Title");          
              setSize(500,300);          
              setLocation(100,100);     
              mainPanel.setVisible(true);
              topPanel.setVisible(true);
             bottomPanel.setVisible(true);
             setVisible(true);
         }          Any suggestions welcome.

  • Problem with extending an extended class

    Hi JDC
    I have to use a scrolled list several times among my program so I create a class named ScrolledList that extends Jpanel and an inner class that extends ScrolledLIst.
    The problem shows up when I?m trying to add an item inside the inner class, the code pass compilation, it even enter the addItem() but its dont add item
    public class ScrolledList extends JPanel{
      DefaultListModel dlm = new DefaultListModel();
      JList list = new JList();
      JScrollPane js = new JScrollPane(list);
      ScrolledList(){
        setLayout(new BorderLayout());
        add(js,BorderLayout.CENTER);
    }here is the class i use whenever i need this scrolled list:
    public class innerClass extends ScrolledList{
      public void addItem(String item){
        System.out.println("addItem invoked...");
        this.dlm.addElement(item);
      public static void main(String[] args) {
            JFrame frame = new JFrame("InnerClass");
            frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {System.exit(0);}
            frame.getContentPane().add(new innerClass(),
                                       BorderLayout.CENTER);
            frame.setSize(400, 125);
            frame.setVisible(true);
            innerClass ic = new innerClass();
            ic.addItem("Shay");
    }what im doing wrong(code example please)?
    Thanks

    Hi
    i tried this , its still dont add item to the list:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ScrolledList extends JPanel{
      //List variables
      private DefaultListModel dlm = new DefaultListModel();
      private JList clientsList = new JList(dlm);;
      private JScrollPane clientScroll = new JScrollPane(clientsList);
      public final  boolean PRINTLN=true;
      public  void p(String out){
        if(PRINTLN)
          System.out.println(out);
      public ScrolledList() {
        try {
          jbInit();
        catch(Exception e) {
          e.printStackTrace();
      private void jbInit() throws Exception {
        this.setLayout(new BorderLayout());
        this.add(clientScroll);
       public void addClient(String client){
        p("addClient invoked....");
        dlm.addElement(client);
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.getContentPane().add(new ScrolledList());
          frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              System.exit(0);
          frame.setSize(300,300);
          frame.setVisible(true);
          ScrolledList s  = new ScrolledList();
          s.addClient("Shay");
    }thanks

  • Extended JPanel not rendering correctly

    I am using a split pane. One pane is a JScrollPane with a JTree attached, the second is a JScrollPane with a JPanel attached. The idea is to show different panels in the second pane depending on which node of the tree is selected.
    My problem is that I when I select a node on my tree in the first panel, my second panel shows only a small grey square.
    My extended JPanel class is:
    public class onePanel extends JPanel {
    public void onePanel() {
    JLabel jLabel1 = new JLabel();
    jLabel1.setText("Node One");
    add(jLabel1);
    In my main I am calling:
    JPanel info = new JPanel();
    JScrollPane myScrollPane = new JScrollPane(info);
    onePanel op = new onePanel();
    info.removeAll();
    info.add(op);
    info.revalidate();
    Any help on this matter would be much appreciated. Let me know if you need more information. Thanks.
    Fox

    My boss helped me with this one as well as bharatchhajer . I'll post the answer for future reference:
    I made the change suggested by bharatchhajer to leave out the intermediate info panel and just deal directly with the JScrollPane.
    In the subclass, instead of using the default constructor OnePanel(), I passed the parent. In this case, OnePanel(myScrollPane).
    I added this to the subclass:
    myScrollPane.add(this);
    Also, instead of myScrollPane.add(info); I used:
    OnePanel op = new OnePanel();
    op.OnePanel(myScrollPane);
    myScrollPane.setViewportView(op);
    So the main problem was that my subclass had no idea about what to attach to. The handle or parent had to be passed to it.
    Fox

  • HELP, HELP, HELP, Problems using GridBagLayout with a BorderLayout

    I have a BorderLayout for my application. I created a JPanel that has the following items added to it:
    1)Button
    2)VisualComponent
    3)ControllerComponent
    The JPanel is then added to the WEST Pane of the BorderLayout. My problem is that I can not get my components in the JPanel to display correctly. The items should be added from top to buttom in my JPanel, but they overlap and display side by side, and some don't appear at all until my entire window application is Maximized. It seems as if all my components are trying to display in one row even though I explicitly add them to different rows as follows:
    1)addUsingGBL(openFile,0,1,2,1);
    2)addUsingGBL(visualComponent,1,1,1,3);
    3)addUsingGBL(controlsComponent,4,1,2,1);
    where addUsingGBL is as follows:
    void addUsingGBL(Component component,int row, int column, int width, int height)
    gbc. gridx = row;
         gbc.gridy = column;
         gbc.gridwidth = width;
         gbc.gridheight = height;
         gbLayout.setConstraints(component, gbc);
         mediaPanel.add(component);
         mediaPanel.doLayout();
    If anyone has any suggestions, I would greatly appreciate it. Entire code is available if needed. Thanks!

    Here is the code, sorry, didn't see that part before.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.media.*;
    public class MediaPlayerDemo extends JFrame /*implements ControllerListener*/{
    private Player player;
    private File file;
    public static JPanel mediaPanel;
    public static JScrollPane scrollableMediaPanel;
    //public static JFrame navigation = new JFrame("Lessons");
    public static Component visualComponent;
    public static Component controlsComponent;
    private static ImageIcon background = new ImageIcon("c:/Tony.jpg");
    public static GridBagConstraints gbc;
    public static GridBagLayout gbLayout;
    //public static panel column;
    //public static Container c;
    // inner class to handler events from media player
    private class EventHandler implements ControllerListener
         public void controllerUpdate( ControllerEvent e )
              if ( e instanceof EndOfMediaEvent)
              //if ( player == null )
              //return;
              player.close();
              //if ( visualComponent != null )
              mediaPanel.remove( visualComponent );
              //if ( controlsComponent != null )
              mediaPanel.remove( controlsComponent );
              mediaPanel.doLayout();
              // doLayout();
              if ( e instanceof RealizeCompleteEvent )
                   //c = getContentPane();
                   // load Visual and Control components if they exist
                   visualComponent =
                   player.getVisualComponent();
                   //visualComponent.setSize(5,5);
                   mediaPanel.doLayout();
                   //**Sets the layout for mediaPanel as GridLayout**
                   //**GridLayouts set the rows and col, **
                   //**& adds contentslt to rt **
                   //scrollableMediaPanel= new JScrollPane(mediaPanel);
                   //scrollableMediaPanel= new JScrollPane(mediaPanel);
                   gbc.weightx = 0;
                   gbc.weighty = 0;
                   gbc.fill = GridBagConstraints.NONE;
                   if ( visualComponent != null )
                   //add comp #2
                   addUsingGBL(visualComponent,1,1,1,3);
                   controlsComponent =
                   player.getControlPanelComponent();
                   if ( controlsComponent != null )
                   //add comp #3
                   //mediaPanel.add(controlsComponent);
                   addUsingGBL(controlsComponent,1,1,1,3);
                   controlsComponent =
                   player.getControlPanelComponent();
                   /*if ( controlsComponent != null )
                   //add comp #3
                   addUsingGBL(controlsComponent,4,1,2,1);
              doLayout();//after all components are added, you must redo your layout
              //**The following is for adding the a container only **
              //**getContentPane().add(mediaPanel,BorderLayout.WEST);**
              //**getContenPane().doLayout(); **
              //**setSize(200,700);//(width, Height) **
              //**show(); **
              }//if
         }//controllerUpdate
    }//eventHandler
    public MediaPlayerDemo()
         //**Title for a container **
         //**super( "Demonstrating the Java Media Player" );**
         mediaPanel = new panelBack(background);//instantiate JPanel Object
         gbLayout = new GridBagLayout();
         mediaPanel.setAlignmentY(TOP_ALIGNMENT);
         mediaPanel.setLayout(gbLayout);
                   gbc = new GridBagConstraints();
                   gbc.fill = GridBagConstraints.NONE;
                   //gbc.anchor = GridBagConstraints.NONE;
         //instatiate JButton object
         JButton openFile = new JButton( "Open file to play" );
         //openFile.setBounds(0, 0, 25, 25);
         //openFile.setVisible(true);
         //JBUTTON ActionListener
         openFile.addActionListener
              new ActionListener()
                   public void actionPerformed( ActionEvent e )
                   openFile();
                   createPlayer();
         );//addActionListener
         //add comp #1
         addUsingGBL(openFile,0,1,2,1);
         //set scrollPane
         scrollableMediaPanel = new JScrollPane(mediaPanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                   JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
         //Set Border
         scrollableMediaPanel.setViewportBorder(new BevelBorder(BevelBorder.RAISED));
    }//Constructor
    private void createPlayer()
         if ( file == null )
              return;
         removePreviousPlayer();
         try
              // create a new player and add listener
              player = Manager.createPlayer( file.toURL() );
              player.addControllerListener( new EventHandler() );
              player.start(); // start player
         catch ( Exception e )
              JOptionPane.showMessageDialog( this,
                   "Invalid file or location", "Error loading file",
                   JOptionPane.ERROR_MESSAGE );
    //Main only useful if creating a container to hold menuPanel
    public static void main(String args[])
         MediaPlayerDemo app = new MediaPlayerDemo();
         app.getContentPane().setLayout(new BorderLayout(0,0));
              app.getContentPane().setBackground(Color.white);
              app.getContentPane().add(scrollableMediaPanel, BorderLayout.WEST);
         app.getContentPane().validate();//re-layout a container for which the layout has changed
         app.setSize(1000,700);//(width, height)
         app.show();
         app.addWindowListener
              new WindowAdapter()
                   public void windowClosing( WindowEvent e )
                   System.exit(0);
    private void openFile()
         JFileChooser fileChooser = new JFileChooser();
         fileChooser.setFileSelectionMode(
              JFileChooser.FILES_ONLY );
         int result = fileChooser.showOpenDialog( this );
         // user clicked Cancel button on dialog
         if ( result == JFileChooser.CANCEL_OPTION )
              file = null;
         else
              file = fileChooser.getSelectedFile();
    private void removePreviousPlayer()
         if ( player == null )
              return;
         player.close();
         if ( visualComponent != null )
              mediaPanel.remove( visualComponent );
         if ( controlsComponent != null )
              mediaPanel.remove( controlsComponent );
         //set background for the JPanel
         public class panelBack extends JPanel
              ImageIcon image;
              panelBack(ImageIcon image)
                   super();
                   this.image=image;
              public void paintComponent(Graphics g)
                   image.paintIcon(this,g,0, 0);
         }//panelback
    void addUsingGBL(Component component,int row, int column, int width, int height)
    gbc = new GridBagConstraints();
         gbc. gridx = row;
         gbc.gridy = column;
         gbc.gridwidth = width;
         gbc.gridheight = height;
         gbLayout.setConstraints(component, gbc);
         mediaPanel.add(component);
         mediaPanel.doLayout();
    }//MediaPlayerDemo

  • JButton not visible after use of Jpanel removeAll ..

    Hi!
    I'm having a calculator class that inherits JFrame. I need to add more buttons after setting an option from the (view) menu bar .. (from normal to scientific calculator). I needed to use the JPanel removeAll method and then add the normal buttons plus extra buttons. But the problem is, that the Buttons are only visible when I touch them with the mouse.
    Does anybody know why? Thanks for your help!
    See code below (still in construction phase):
    Name: Hemanth. B
    Original code from Website: java-swing-tutorial.html
    Topic : A basic Java Swing Calculator
    Conventions Used in Source code
         1. All JLabel components start with jlb*
         2. All JPanel components start with jpl*
         3. All JMenu components start with jmenu*
         4. All JMenuItem components start with jmenuItem*
         5. All JDialog components start with jdlg*
         6. All JButton components start with jbn*
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Calculator extends JFrame
    implements ActionListener {
    // Constants
    final int NORMAL = 0;
    final int SCIENTIFIC = 8;
    final int MAX_INPUT_LENGTH = 20;
    final int INPUT_MODE = 0;
    final int RESULT_MODE = 1;
    final int ERROR_MODE = 2;
    // Variables
    int displayMode;
    int calcType = SCIENTIFIC;
    boolean clearOnNextDigit, percent;
    double lastNumber;
    String lastOperator, title;
    private JMenu jmenuFile, jmenuView, jmenuHelp;
    private JMenuItem jmenuitemExit, jmenuitemAbout;
    private JRadioButtonMenuItem jmenuItemNormal = new JRadioButtonMenuItem("Normal");
    private JRadioButtonMenuItem jmenuItemScientific = new JRadioButtonMenuItem("Scientific");
    private     ButtonGroup viewMenuButtonGroup = new ButtonGroup();
    private JLabel jlbOutput;
    private JButton jbnButtons[];
    private JPanel jplButtons, jplMaster, jplBackSpace, jplControl;
    * Font(String name, int style, int size)
    Creates a new Font from the specified name, style and point size.
    Font f12 = new Font("Verdana", 0, 12);
    Font f121 = new Font("Verdana", 1, 12);
    // Constructor
    public Calculator(String title) {
    /* Set Up the JMenuBar.
    * Have Provided All JMenu's with Mnemonics
    * Have Provided some JMenuItem components with Keyboard Accelerators
         //super(title);
         this.title = title;
         //displayCalculator(title);
    }     //End of Contructor Calculator
    private void displayCalculator (String title) {
         //add WindowListener for closing frame and ending program
         addWindowListener (
         new WindowAdapter() {     
         public void windowClosed(WindowEvent e) {
         System.exit(0);
         //setResizable(false);
    //Set frame layout manager
         setBackground(Color.gray);
         validate();
         createMenuBar();
         createMasterPanel();      
         createDisplayPanel();
         clearAll();
         this.getContentPane().validate();
         requestFocus();
         pack();
         //getContentPane().
         setVisible(true);
    private void createMenuBar() {
    jmenuFile = new JMenu("File");
    jmenuFile.setFont(f121);
    jmenuFile.setMnemonic(KeyEvent.VK_F);
    jmenuitemExit = new JMenuItem("Exit");
    jmenuitemExit.setFont(f12);
    jmenuitemExit.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_X,
                                            ActionEvent.CTRL_MASK));
    jmenuFile.add(jmenuitemExit);
    jmenuView = new JMenu("View");
    jmenuFile.setFont(f121);
    jmenuFile.setMnemonic(KeyEvent.VK_W);
    jmenuItemNormal.setMnemonic(KeyEvent.VK_N);
    viewMenuButtonGroup.add(jmenuItemNormal);
    jmenuView.add(jmenuItemNormal);
    jmenuItemScientific.setMnemonic(KeyEvent.VK_S);
    viewMenuButtonGroup.add(jmenuItemScientific);
    jmenuView.add(jmenuItemScientific);
    if (jmenuItemNormal.isSelected() == false &&
    jmenuItemScientific.isSelected() == false)
    jmenuItemScientific.setSelected(true);
         jmenuHelp = new JMenu("Help");
         jmenuHelp.setFont(f121);
         jmenuHelp.setMnemonic(KeyEvent.VK_H);
         jmenuitemAbout = new JMenuItem("About Calculator");
         jmenuitemAbout.setFont(f12);
         jmenuHelp.add(jmenuitemAbout);
         JMenuBar menubar = new JMenuBar();
         menubar.add(jmenuFile);
         menubar.add(jmenuView);
         menubar.add(jmenuHelp);
         setJMenuBar(menubar);
         jmenuItemNormal.addActionListener(this);
         jmenuItemScientific.addActionListener(this);
         jmenuitemAbout.addActionListener(this);
         jmenuitemExit.addActionListener(this);
    private void createDisplayPanel() {
         if (jlbOutput != null) {
         jlbOutput.removeAll();     
         jlbOutput = new JLabel("0",JLabel.RIGHT);
         jlbOutput.setBackground(Color.WHITE);
         jlbOutput.setOpaque(true);
         // Add components to frame
         getContentPane().add(jlbOutput, BorderLayout.NORTH);
         jlbOutput.setVisible(true);
    private void createMasterPanel() {
         if (jplMaster != null) {
         jplMaster.removeAll();     
         jplMaster = new JPanel(new BorderLayout());
         createCalcButtons();      
         jplMaster.add(jplBackSpace, BorderLayout.WEST);
         jplMaster.add(jplControl, BorderLayout.EAST);
         jplMaster.add(jplButtons, BorderLayout.SOUTH);
         ((JPanel)getContentPane()).revalidate();
         // Add components to frame
         getContentPane().add(jplMaster, BorderLayout.SOUTH);
         jplMaster.setVisible(true);
    private void createCalcButtons() {
         int rows = 4;
         int cols = 5 + calcType/rows;
         jbnButtons = new JButton[31];
         // Create numeric Jbuttons
         for (int i=0; i<=9; i++) {
         // set each Jbutton label to the value of index
         jbnButtons[i] = new JButton(String.valueOf(i));
         // Create operator Jbuttons
         jbnButtons[10] = new JButton("+/-");
         jbnButtons[11] = new JButton(".");
         jbnButtons[12] = new JButton("=");
         jbnButtons[13] = new JButton("/");
         jbnButtons[14] = new JButton("*");
         jbnButtons[15] = new JButton("-");
         jbnButtons[16] = new JButton("+");
         jbnButtons[17] = new JButton("sqrt");
         jbnButtons[18] = new JButton("1/x");
         jbnButtons[19] = new JButton("%");
         jplBackSpace = new JPanel();
         jplBackSpace.setLayout(new GridLayout(1, 1, 2, 2));
         jbnButtons[20] = new JButton("Backspace");
         jplBackSpace.add(jbnButtons[20]);
         jplControl = new JPanel();
         jplControl.setLayout(new GridLayout(1, 2, 2 ,2));
         jbnButtons[21] = new JButton(" CE ");
         jbnButtons[22] = new JButton("C");
         jplControl.add(jbnButtons[21]);
         jplControl.add(jbnButtons[22]);
         //if (calcType == SCIENTIFIC) {     
         jbnButtons[23] = new JButton("s");
         jbnButtons[24] = new JButton("t");
         jbnButtons[25] = new JButton("u");
         jbnButtons[26] = new JButton("v");
         jbnButtons[27] = new JButton("w");
         jbnButtons[28] = new JButton("x");
         jbnButtons[29] = new JButton("y");
         jbnButtons[30] = new JButton("z");
    // Setting all Numbered JButton's to Blue. The rest to Red
         for (int i=0; i<jbnButtons.length; i++)     {
         //activate ActionListener
         System.out.println("add action listener: " + i);
         jbnButtons.addActionListener(this);
         //set button text font/colour
         jbnButtons[i].setFont(f12);
         jbnButtons[i].invalidate();
         if (i<10)
              jbnButtons[i].setForeground(Color.blue);               
         else
              jbnButtons[i].setForeground(Color.red);
         // container for Jbuttons
         jplButtons = new JPanel(new GridLayout(rows, cols, 2, 2));
    System.out.println("Cols: " + cols);      
         //Add buttons to keypad panel starting at top left
         // First row
         // extra left buttons for scientific
         if (calcType == SCIENTIFIC) {
         System.out.println("Adding Scientific buttons");
         setSize(400, 217);
         setLocation(200, 250);
         jplButtons.add(jbnButtons[23]);
         jplButtons.add(jbnButtons[27]);
         } else {
         setSize(241, 217);
         setLocation(200, 250);
         for(int i=7; i<=9; i++)          {
         jplButtons.add(jbnButtons[i]);
         // add button / and sqrt
         jplButtons.add(jbnButtons[13]);
         jplButtons.add(jbnButtons[17]);
         // Second row
         // extra left buttons for scientific
         if (calcType == SCIENTIFIC) {
         System.out.println("Adding Scientific buttons");
         jplButtons.add(jbnButtons[24]);
         jplButtons.add(jbnButtons[28]);
         for(int i=4; i<=6; i++)     {
         jplButtons.add(jbnButtons[i]);
         // add button * and x^2
         jplButtons.add(jbnButtons[14]);
         jplButtons.add(jbnButtons[18]);
         // Third row
         // extra left buttons for scientific
         if (calcType == SCIENTIFIC) {
         System.out.println("Adding Scientific buttons");
         jplButtons.add(jbnButtons[25]);
         jplButtons.add(jbnButtons[29]);
         for( int i=1; i<=3; i++) {
         jplButtons.add(jbnButtons[i]);
         //adds button - and %
         jplButtons.add(jbnButtons[15]);
         jplButtons.add(jbnButtons[19]);
         //Fourth Row
         // extra left buttons for scientific
         if (calcType == SCIENTIFIC) {
         System.out.println("Adding Scientific buttons");
         jplButtons.add(jbnButtons[26]);
         jplButtons.add(jbnButtons[30]);
         // add 0, +/-, ., +, and =
         jplButtons.add(jbnButtons[0]);
         jplButtons.add(jbnButtons[10]);
         jplButtons.add(jbnButtons[11]);
         jplButtons.add(jbnButtons[16]);
         jplButtons.add(jbnButtons[12]);
         jplButtons.revalidate();
    // Perform action
    public void actionPerformed(ActionEvent e){
         double result = 0;
         if(e.getSource() == jmenuitemAbout) {
         //JDialog dlgAbout = new CustomABOUTDialog(this,
         //                              "About Java Swing Calculator", true);
         //dlgAbout.setVisible(true);
         } else if(e.getSource() == jmenuitemExit) {
         System.exit(0);
    if (e.getSource() == jmenuItemNormal) {
    calcType = NORMAL;
    displayCalculator(title);
    if (e.getSource() == jmenuItemScientific) {
    calcType = SCIENTIFIC;
    displayCalculator(title);
    System.out.println("Calculator is set to "
    + (calcType == NORMAL?"Normal":"Scientific") + " :" + jbnButtons.length);      
         // Search for the button pressed until end of array or key found
         for (int i=0; i<jbnButtons.length; i++)     {
         if(e.getSource() == jbnButtons[i]) {
              System.out.println(i);
              switch(i) {
              case 0:
                   addDigitToDisplay(i);
                   break;
              case 1:
                   System.out.println("1");
                   addDigitToDisplay(i);
                   break;
              case 2:
                   addDigitToDisplay(i);
                   break;
              case 3:
                   addDigitToDisplay(i);
                   break;
              case 4:
                   addDigitToDisplay(i);
                   break;
              case 5:
                   addDigitToDisplay(i);
                   break;
              case 6:
                   addDigitToDisplay(i);
                   break;
              case 7:
                   addDigitToDisplay(i);
                   break;
              case 8:
                   addDigitToDisplay(i);
                   break;
              case 9:
                   addDigitToDisplay(i);
                   break;
              case 10:     // +/-
                   processSignChange();
                   break;
              case 11:     // decimal point
                   addDecimalPoint();
                   break;
              case 12:     // =
                   processEquals();
                   break;
              case 13:     // divide
                   processOperator("/");
                   break;
              case 14:     // *
                   processOperator("*");
                   break;
              case 15:     // -
                   processOperator("-");
                   break;
              case 16:     // +
                   processOperator("+");
                   break;
              case 17:     // sqrt
                   if (displayMode != ERROR_MODE) {
                   try {
                        if (getDisplayString().indexOf("-") == 0)
                        displayError("Invalid input for function!");
                        result = Math.sqrt(getNumberInDisplay());
                        displayResult(result);
                   catch(Exception ex) {
                        displayError("Invalid input for function!");
                        displayMode = ERROR_MODE;
                   break;
              case 18:     // 1/x
                   if (displayMode != ERROR_MODE){
                   try {
                        if (getNumberInDisplay() == 0)
                        displayError("Cannot divide by zero!");
                        result = 1 / getNumberInDisplay();
                        displayResult(result);
                   catch(Exception ex) {
                        displayError("Cannot divide by zero!");
                        displayMode = ERROR_MODE;
                   break;
              case 19:     // %
                   if (displayMode != ERROR_MODE){
                   try {
                        result = getNumberInDisplay() / 100;
                        displayResult(result);
                   catch(Exception ex) {
                        displayError("Invalid input for function!");
                        displayMode = ERROR_MODE;
                   break;
              case 20:     // backspace
                   if (displayMode != ERROR_MODE) {
                   setDisplayString(getDisplayString().substring(0,
                   getDisplayString().length() - 1));
                   if (getDisplayString().length() < 1)
                        setDisplayString("0");
                   break;
              case 21:     // CE
                   clearExisting();
                   break;
              case 22:     // C
                   clearAll();
                   break;
    void setDisplayString(String s) {
         jlbOutput.setText(s);
    String getDisplayString () {
         return jlbOutput.getText();
    void addDigitToDisplay(int digit) {
         if (clearOnNextDigit)
         setDisplayString("");
         String inputString = getDisplayString();
         if (inputString.indexOf("0") == 0) {
         inputString = inputString.substring(1);
         if ((!inputString.equals("0") || digit > 0)
                             && inputString.length() < MAX_INPUT_LENGTH) {
         setDisplayString(inputString + digit);
         displayMode = INPUT_MODE;
         clearOnNextDigit = false;
    void addDecimalPoint() {
         displayMode = INPUT_MODE;
         if (clearOnNextDigit)
         setDisplayString("");
         String inputString = getDisplayString();
         // If the input string already contains a decimal point, don't
         // do anything to it.
         if (inputString.indexOf(".") < 0)
         setDisplayString(new String(inputString + "."));
    void processSignChange() {
         if (displayMode == INPUT_MODE) {
         String input = getDisplayString();
         if (input.length() > 0 && !input.equals("0"))     {
              if (input.indexOf("-") == 0)
              setDisplayString(input.substring(1));
              else
              setDisplayString("-" + input);
         } else if (displayMode == RESULT_MODE) {
         double numberInDisplay = getNumberInDisplay();
         if (numberInDisplay != 0)
         displayResult(-numberInDisplay);
    void clearAll() {
         setDisplayString("0");
         lastOperator = "0";
         lastNumber = 0;
         displayMode = INPUT_MODE;
         clearOnNextDigit = true;
    void clearExisting() {
         setDisplayString("0");
         clearOnNextDigit = true;
         displayMode = INPUT_MODE;
    double getNumberInDisplay()     {
         String input = jlbOutput.getText();
         return Double.parseDouble(input);
    void processOperator(String op) {
         if (displayMode != ERROR_MODE) {
         double numberInDisplay = getNumberInDisplay();
         if (!lastOperator.equals("0")) {
              try {
              double result = processLastOperator();
              displayResult(result);
              lastNumber = result;
              catch (DivideByZeroException e)     {
              displayError("Cannot divide by zero!");
         } else {
         lastNumber = numberInDisplay;
         clearOnNextDigit = true;
         lastOperator = op;
    void processEquals() {
         double result = 0;
         if (displayMode != ERROR_MODE){
         try {
              result = processLastOperator();
              displayResult(result);
         catch (DivideByZeroException e) {
              displayError("Cannot divide by zero!");
         lastOperator = "0";
    double processLastOperator() throws DivideByZeroException {
         double result = 0;
         double numberInDisplay = getNumberInDisplay();
         if (lastOperator.equals("/")) {
         if (numberInDisplay == 0)
              throw (new DivideByZeroException());
         result = lastNumber / numberInDisplay;
         if (lastOperator.equals("*"))
         result = lastNumber * numberInDisplay;
         if (lastOperator.equals("-"))
         result = lastNumber - numberInDisplay;
         if (lastOperator.equals("+"))
         result = lastNumber + numberInDisplay;
         return result;
    void displayResult(double result){
         setDisplayString(Double.toString(result));
         lastNumber = result;
         displayMode = RESULT_MODE;
         clearOnNextDigit = true;
    void displayError(String errorMessage){
         setDisplayString(errorMessage);
         lastNumber = 0;
         displayMode = ERROR_MODE;
         clearOnNextDigit = true;
    public static void main(String args[]) {
         Calculator calci = new Calculator("My Calculator");
         calci.displayCalculator("My Calculator");
    System.out.println("Exitting...");
    }     //End of Swing Calculator Class.
    class DivideByZeroException extends Exception{
    public DivideByZeroException() {
         super();
    public DivideByZeroException(String s) {
         super(s);
    class CustomABOUTDialog extends JDialog implements ActionListener {
    JButton jbnOk;
    CustomABOUTDialog(JFrame parent, String title, boolean modal){
         super(parent, title, modal);
         setBackground(Color.black);
         JPanel p1 = new JPanel(new FlowLayout(FlowLayout.CENTER));
         StringBuffer text = new StringBuffer();
         text.append("Calculator Information\n\n");
         text.append("Developer:     Hemanth\n");
         text.append("Version:     1.0");
         JTextArea jtAreaAbout = new JTextArea(5, 21);
         jtAreaAbout.setText(text.toString());
         jtAreaAbout.setFont(new Font("Times New Roman", 1, 13));
         jtAreaAbout.setEditable(false);
         p1.add(jtAreaAbout);
         p1.setBackground(Color.red);
         getContentPane().add(p1, BorderLayout.CENTER);
         JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER));
         jbnOk = new JButton(" OK ");
         jbnOk.addActionListener(this);
         p2.add(jbnOk);
         getContentPane().add(p2, BorderLayout.SOUTH);
         setLocation(408, 270);
         setResizable(false);
         addWindowListener(new WindowAdapter() {
              public void windowClosing(WindowEvent e) {
                   Window aboutDialog = e.getWindow();
                   aboutDialog.dispose();
         pack();
    public void actionPerformed(ActionEvent e) {
         if(e.getSource() == jbnOk) {
         this.dispose();
    Message was edited by:
    dungorg

    Swing related questions should be posted in the Swing forum.
    After adding or removing components from a visible panel you need to use panel.revalidate() and sometimes panel.repaint();
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.

  • Unwanted space within an extended JPanel

    Hello JDC
    I subclass the Jpanel and I draw an image inside. The problem is that I receive unwanted empty space in the canvas bounds. I tried to set the mini,maxi and preferred size of both the jframe and the canvas but its doesnt help.
    public class ImageCanvas extends JPanel{
      static Image thisImg=null;
      static URL url=null;
      static Toolkit tool=null;
      public static final String DEFAULTADDRESS = "http://127.0.0.1/image/def.gif";
      public static final  boolean PRINTLN=true;
      public  static void p(String out){
        if(PRINTLN)
          System.out.println(out);
      // constructs a
      public ImageCanvas(String filepath){
         setLayout(new BorderLayout());
         try{
          url = new URL(filepath);
        }catch(Exception e){
          System.out.println("problem with creating url :" + e.toString());
        thisImg = Toolkit.getDefaultToolkit().getImage(url);
      public ImageCanvas(){
        try{
          url = new URL(DEFAULTADDRESS);
        }catch(Exception e){
          System.out.println("problem with creating url :" + e.toString());
        thisImg = Toolkit.getDefaultToolkit().getImage(url);
        repaint();
      public void setPic(Image x){
        //System.out.println("ImageCanvas > setPit(Image) invoked");
        thisImg = x;
        repaint();
      public static Image makeImage(String path){
        try{
          url = new URL(path);
        }catch(Exception e){
          System.out.println("problem with creating url :" + e.toString());
        Image img = Toolkit.getDefaultToolkit().getImage(url);
        return img;
      public void paintComponent(Graphics g){
        g.drawImage(thisImg,0,0,this);
    public void update(Graphics g){
        paint(g);
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.getContentPane().add(new ImageCanvas());
          frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              System.exit(0);
        frame.pack();
        frame.setVisible(true);
    }the image dimension 100x100
    Any replies will by imprecated
    Shay Gaghe

    You could try using JLabel instead of subclassing JPanel. Just set the label's icon and don't set any text.
    I also agree that GridBagLayout is the most useful layout. When I was new to Java programming it was the most confusing. In order to do complicated graphical interfaces I use to have to use a lot of nested panels with different layouts. Even then I had problems because I couldn't specify exactly which component should expand etc. Now, two years later and after becoming a Sun certified programmer for the Java 2 platform, I use GridBagLayouts almost always and it give me the most flexibility. It allows me to make some really professional gui programs. I recommend spending some time getting used to using GridBagLayout more.

  • Problem using the setPage(String url) of JEditorPane

    Hi all !
    I'm developping a text file generator which generates a text file and use a viewer to display the content of this text file.
    The first time, it works correctly, it displays the text file content but the others times it doesn't work correctly, the first text file content remains displayed.
    It seems that the setpage(String url) method doesn't work correctly.
    Does anyone know this problem ?
    In advance, thanks a lot.
    Best regards,
    Farid.
    Here is the code of the viewer:
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.lang.*;
    public class ViewerQCM extends JPanel {
         private JPanel panelSouth;
         private JLabel titreLabel;
         private JButton genererQCMButton;
         private JEditorPane editorPane;
         private JScrollPane scrollPane;
         public ViewerQCM() {
              JFrame frame = new JFrame("G�n�rateur de QCM");
              setLayout(new BorderLayout());
              panelSouth = new JPanel();
              panelSouth.setLayout(new FlowLayout());
    titreLabel = new JLabel("G�n�rateur de QCM", SwingConstants.CENTER);
              editorPane = new JEditorPane();
              editorPane.setContentType("text/plain");
    editorPane.setText("Cliquer sur le bouton \" G�n�rer QCM \" ");
              editorPane.setEditable(false);
              genererQCMButton = new JButton("G�n�rer QCM");
              genererQCMButton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
              GenerateurDeQCM.getInstance().init();
              GenerateurDeQCM.getInstance().generateQuestionnaire();
                        try {
    editorPane.setPage("file:" + AccesBase.getString("generateur.QCM"));
                        catch (IOException ex) {
                             ex.printStackTrace();
    LogFile.getInstance().write("Exception *** IOException caught in constructor ViewerQCM() ***");
                   LogFile.getInstance().write(ex.getMessage());
                   LogFile.getInstance().flush();
              scrollPane = new JScrollPane(editorPane);
              add(titreLabel, BorderLayout.NORTH);
              add(scrollPane, BorderLayout.CENTER);
              panelSouth.add(genererQCMButton);
              add(panelSouth, BorderLayout.SOUTH);
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.getContentPane().add(this);
    frame.pack();
    frame.setSize(500,600);
    frame.setVisible(true);
         public static void main(String args[]) {
              new ViewerQCM();
    }

    hi,
    there is some problem with JedtorPane when you update the page. Image or not updated all the time because the buffer keep the old image and does not update it. The problem is that class got to much protected field so you cannot change nothing. It is a bug since Two years and no body as correct it.

  • GUI Problem (Swing JFrame/JPanel). HELP!

    Hi,
    I made an small application for calculate some things.
    I download i piece of code for creating bar chart and i icluded in my code. But i have problem when i am trying to show the chart in the Frame. All the buttons, textfields, labels goes to left and half are hiding.
    If i open the chart on a new frame i dont have problem.
    the problem apears when after i put the panel in the frame i try to put the chart in the frame. Look the code:
    add(p);     //Put the panel in the Frame
    this.getContentPane().add(new ChartPanel(values, names, "Fertilizer Plant")); // <-- The problem!!that command mades me the problem!
    Here are 2 screenshots
    1. When i put the chart in the Frame (the problem)
    http://www.iweb.gr/images/InFrame.jpg
    2. When i put the chart on new frame (works fine)
    http://www.iweb.gr/images/NewFrame.jpg
    Hopes someone can help. Thanks
    The code List:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    //The main class of the program
    public class PlantFertilizer  extends JFrame{//The main class is a subclass of Frame
         private Label lN, lP,lK;//These show the value of the observable
         public TextField tN, tP, tK;
         private MyData thedata;//The observable we are going to watch
         private double[] values=new double[3];
        private String[] names=new String[3];
        private String title;
    public PlantFertilizer(){
         thedata=new MyData();// create the observable
         addWindowListener(new WindowAdapter(){//if user closes the Frame, quit
              public void windowClosing(WindowEvent e){
                   System.exit(0);
         setSize(400,500);//Set size
         setTitle(getClass().getName()+" By Pantelis Stoumpis");
         JPanel p = new JPanel();    //Make a panel for buttons and output
         //Input Data Area
         p.add(new Label("-------------------------Input Data Area--------------------------",Label.CENTER));
         p.add(new Label("Nitrogen (N)"));
         tN = new TextField();p.add(tN);
         p.add(new Label("Phosphorus (P)"));
         tP = new TextField();p.add(tP);
         p.add(new Label("Potassium (K)"));
         tK = new TextField();p.add(tK);
         lN=new Label("N = %", Label.CENTER);
         p.add(lN);     //Put the N label in the panel
         lP=new Label("P = %", Label.CENTER);
         p.add(lP);          //Put the P label in the panel
         lK=new Label("K = %", Label.CENTER);
         p.add(lK);          //Put the K label in the panel
         addButton(p,"Apply",          //Apply new Values
         new ActionListener(){
         public void actionPerformed(ActionEvent evt){
              int iNt = Integer.parseInt(tN.getText());
              int iPt = Integer.parseInt(tP.getText());
              int iKt = Integer.parseInt(tK.getText());
              thedata.addOne(iNt,iPt,iKt);          //which adds one to the observable
              JFrame f = new JFrame();
             f.setSize(400, 300);
              values[0] = 40;
             names[0] = "N";
             values[1] = 20;
             names[1] = "P";
             values[2] = 30;
             names[2] = "K";
             f.getContentPane().add(new ChartPanel(values, names, "Fertilizer Plant"));
              f.setVisible(true);
         addButton(p,"Close",          //add a close button to quit the program
         new ActionListener(){
         public void actionPerformed(ActionEvent evt){
              System.exit(0);
    add(p);     //Put the panel in the Frame
    this.getContentPane().add(new ChartPanel(values, names, "Fertilizer Plant")); // <-- The problem!!
    //A utility function to add a button with a given title and action
    public void addButton(Container c, String title,ActionListener a)
              Button b=new Button(title);
              c.add(b);
              b.addActionListener(a);
    public class ChartPanel extends JPanel {
      private double[] values;
      private String[] names;
      private String title;
      public ChartPanel(double[] v, String[] n, String t) {
        names = n;
        values = v;
        title = t;
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (values == null || values.length == 0)
          return;
        double minValue = 0;
        double maxValue = 0;
        for (int i = 0; i < values.length; i++) {
          if (minValue > values)
    minValue = values[i];
    if (maxValue < values[i])
    maxValue = values[i];
    //Dimension d = getSize();
    //int clientWidth = d.width;
    //int clientHeight = d.height;
    //int barWidth = clientWidth / values.length;
    //Dimension d = 100;
         int clientWidth = 100;
         int clientHeight = 150;
    int barWidth = clientWidth / values.length;
    Font titleFont = new Font("SansSerif", Font.BOLD, 12);
    FontMetrics titleFontMetrics = g.getFontMetrics(titleFont);
    Font labelFont = new Font("SansSerif", Font.PLAIN, 10);
    FontMetrics labelFontMetrics = g.getFontMetrics(labelFont);
    int titleWidth = titleFontMetrics.stringWidth(title);
    int y = titleFontMetrics.getAscent();
    int x = (clientWidth - titleWidth) / 2;
    g.setFont(titleFont);
    g.drawString(title, 10, 300);
    int top = titleFontMetrics.getHeight();
    int bottom = labelFontMetrics.getHeight();
    if (maxValue == minValue)
    return;
    double scale = (clientHeight - top - bottom) / (maxValue - minValue);
    y = clientHeight - labelFontMetrics.getDescent();
    g.setFont(labelFont);
    for (int i = 0; i < values.length; i++) {
    int valueX = i * barWidth + 1;
    int valueY = top;
    int height = (int) (values[i] * scale);
    if (values[i] >= 0)
    valueY += (int) ((maxValue - values[i]) * scale);
    else {
    valueY += (int) (maxValue * scale);
    height = -height;
    g.setColor(Color.red);
    g.fillRect(valueX, valueY, barWidth - 2, height);
    g.setColor(Color.black);
    g.drawRect(valueX, valueY, barWidth - 2, height);
    int labelWidth = labelFontMetrics.stringWidth(names[i]);
    x = i * barWidth + (barWidth - labelWidth) / 2;
    g.drawString(names[i], x, y);
    //main is called when we start the application
    public static void main(String[]args){
                   PlantFertilizer od = new PlantFertilizer();//make an observationsDemo frame
                   NWatcher watchitN = new NWatcher(od.lN);//make an observer
                   od.thedata.addObserver(watchitN);//register observer with the observable
                   PWatcher watchitP = new PWatcher(od.lP);//make an observer
                   od.thedata.addObserver(watchitP);//register observer with the observable
                   KWatcher watchitK = new KWatcher(od.lK);//make an observer
                   od.thedata.addObserver(watchitK);//register observer with the observable
                   od.setVisible(true);//show the frame on the screen

    Why are you putting Labels and TextFields (heavyweight AWT components) into a lightweight JPanels?
    What's the first rule of Swing? DO NOT MIX heavyweight AWT components and lightweight Swing components. Period. Never.
    There's Swing equivalents for every single AWT component, and then some. There's no excuse for not using them.
    However, if this chart library code is AWT based, then you should make a completely AWT based UI. Or find a different library based on Swing (like JFreeChart).
    And finally:
    add(p);     //Put the panel in the Frame
    this.getContentPane().add(new ChartPanel(values, names, "Fertilizer Plant")); // <-- The problem!!is wrong....
    add(p);      // <-- The problem!!
    this.getContentPane().add(new ChartPanel(values, names, "Fertilizer Plant"));You don't call add on JFrame or JDialog to add things to it, unless you know what you're doing. And you clearly don't, else you wouldn't have done it. What you probably want to do is this:
    this.getContentPane().add(p, BorderLayout.SOUTH);
    this.getContentPane().add(new ChartPanel(values, names, "Fertilizer Plant"), BorderLayout.CENTER);

  • Serious problem with TitledBorder(jPanel)

    I have a serious problem with TitledBorder(jPanel)
    Here, I have two class the first it contains a jTabbedPane ( class_jTabbedPane)qui call the second which contains a jPanel (Ptableau) which contains a jTable in a jPanel with TitledBorder
    The problem that one I carry out the jPanel with the title does not post
    Thank you! of your assistance.
    The source of the example is as follows:
    package jtabbedpane_titledborder;
    import java.awt.*;
    import javax.swing.*;
    public class class_jTabbedPane extends JFrame {
    PTableau PT = new PTableau();
    private JPanel jPanel1 = new JPanel();
    private JPanel jPanel2 = new JPanel();
    private JLabel jLabel3 = new JLabel();
    private JLabel jLabel2 = new JLabel();
    private JTabbedPane jTabbedPane1 = new JTabbedPane();
    public class_jTabbedPane() {
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception {
    this.setSize(new Dimension(540, 515));
    jPanel1.setBackground(Color.lightGray);
    jPanel1.setBorder(BorderFactory.createEtchedBorder());
    jPanel1.setLayout(null);
    jPanel2.setBackground(new Color(27, 85, 135));
    jPanel2.setBorder(BorderFactory.createEtchedBorder());
    jPanel2.setBounds(new Rectangle(8, 7, 515, 47));
    jPanel2.setLayout(null);
    jLabel3.setFont(new java.awt.Font("Serif", 1, 25));
    jLabel3.setText("Consultation circuits");
    jLabel3.setBounds(new Rectangle(12, 12, 280, 27));
    jLabel2.setFont(new java.awt.Font("Serif", 1, 25));
    jLabel2.setForeground(SystemColor.activeCaptionBorder);
    jLabel2.setText("Consultation circuits");
    jLabel2.setBounds(new Rectangle(15, 5, 260, 32));
    jTabbedPane1.setBounds(new Rectangle(8, 62, 515, 450));
    PT.setLayout(null);
    this.getContentPane().add(jPanel1, BorderLayout.CENTER);
    jPanel1.add(jPanel2, null);
    jPanel2.add(jLabel2, null);
    jPanel2.add(jLabel3, null);
    jPanel1.add(jTabbedPane1, null);
    jTabbedPane1.add(PT,"Tableau");
    //jTabbedPane1.add(PA,"Arborescence");
    public static void main(String[] args) {
    class_jTabbedPane Ct = new class_jTabbedPane();
    Ct.setVisible(true);
    package jtabbedpane_titledborder;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.border.TitledBorder.*;
    public class PTableau extends JPanel {
    private JPanel jPanel9 = new JPanel();
    private JPanel jPanel5 = new JPanel();
    TitledBorder titledBorder5;
    TitledBorder titledBorder4;
    private JPanel jPanel4 = new JPanel();
    private JScrollPane jScrollPane2 = new JScrollPane();
    private JTable jTable1 = new JTable(4, 4 );
    private BorderLayout borderLayout1 = new BorderLayout();
    public PTableau() {
    try {
    jbInit();
    catch(Exception ex) {
    ex.printStackTrace();
    void jbInit() throws Exception {
    jPanel9.setBackground(new Color(27, 85, 135));
    jPanel9.setBorder(BorderFactory.createEtchedBorder());
    jPanel9.setBounds(new Rectangle(1, 1, 540, 350));
    jPanel9.setLayout(null);
    this.setLayout(null);
    jPanel5.setBackground(new Color(27, 85, 135));
    jPanel5.setForeground(Color.white);
    jPanel5.setBorder(BorderFactory.createEtchedBorder());
    jPanel5.setBounds(new Rectangle(12, 88, 501, 183));
    jPanel5.setLayout(borderLayout1);
    jPanel5.setBorder(titledBorder5);
    titledBorder5 = new TitledBorder(" Liste des circuits ");
    titledBorder5.setTitleColor(Color.white);
    jPanel4.setBackground(new Color(27, 85, 135));
    jPanel4.setBorder(BorderFactory.createEtchedBorder());
    jPanel4.setBounds(new Rectangle(211, 3, 291, 44));
    jPanel4.setLayout(null);
    jPanel4.setBorder(titledBorder4);
    titledBorder4 = new TitledBorder(" Liste des circuits ");
    jScrollPane2.getViewport().setBackground(Color.white);
    this.add(jPanel9, null);
    jPanel9.add(jPanel4, null);
    jPanel9.add(jPanel5, null);
    jPanel5.add(jScrollPane2, BorderLayout.CENTER);
    jScrollPane2.getViewport().add(jTable1, null);

    Create your border first, then set the panels border. Do this:
    &#91;code&#93;    titledBorder5 = new TitledBorder(" Liste des circuits ");
        titledBorder5.setTitleColor(Color.white);
        jPanel5.setBorder(titledBorder5);
        jPanel4.setBackground(new Color(27, 85, 135));
    //    jPanel4.setBorder(BorderFactory.createEtchedBorder()); // redundant
        titledBorder4 = new TitledBorder(" Liste des circuits ");
        jPanel4.setBorder(titledBorder4);&#91;/code&#93;
    Not this
    &#91;code&#93;    jPanel5.setBorder(titledBorder5);
        titledBorder5 = new TitledBorder(" Liste des circuits ");
        titledBorder5.setTitleColor(Color.white);
        jPanel4.setBackground(new Color(27, 85, 135));
        jPanel4.setBorder(titledBorder4);
        titledBorder4 = new TitledBorder(" Liste des circuits ");&#91;/code&#93;
    You should also use code tags as I have demonstrated above. It makes you code easier to read for the people you are asking to help you. You can read about them under Formatting Help on the page you post on.

  • Problem using clearrect()

    http://www.badguy.nl/images/graphics2dproblem.png
    That image basically describes my problem, it keeps drawing what I want to draw over it-self, using clearrect() it just gives me grey in the back ground when I draw a rect with 0 alpha over it, it presents me with black in stead of something that has 0 alpha. The pane with the selection thing drawn on it is a glasspane of the JDialog you see.
    The code:
    package org.fcst.pgfs.plugin.buildingplugin.floorbuilder;
    import java.awt.AlphaComposite;
    import java.awt.Color;
    import java.awt.Composite;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GraphicsConfiguration;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
    import java.awt.geom.Rectangle2D;
    import java.awt.image.BufferedImage;
    import javax.swing.JComponent;
    public class SelectionPane extends JComponent {
         private DragableSelection selection;
         public SelectionPane () {
              this.setVisible(false);
              this.setOpaque(false);
              selection = new DragableSelection(this);
         public void startDrag (Point p) {
              selection.startDrag(p);
         public void endDrag (Point p) {
              selection.endDrag(p);
         public void updateDrag (Point p) {
              selection.updateDrag(p);
              this.paintComponent(this.getGraphics());
         public DragableSelection getSelection () {
              return selection;
         public void paintComponent (Graphics g) {
              super.paintComponent(g);
              selection.paintComponent(g);
    class DragableSelection {
         private boolean isdragging = false, interuptdrag = false;
         private Point startPoint, endPoint, currentPoint, location;
         private Point oldLocation;
         private Dimension oldDimension;
         private Dimension dimension;
         private Composite originalComposite;
         private BufferedImage image;
         private SelectionPane pane;
         public DragableSelection (SelectionPane pane) {
              this.pane = pane;
         public void interruptDragging () {
              interuptdrag = true;
         public void resumeDragging () {
              interuptdrag = false;
         public Point getStartPoint () {
              return startPoint;
         public Point getLocation () {
              return location;
         public Point getEndPoint () {
              return endPoint;
         public Dimension getDimension () {
              return dimension;
         public void startDrag (Point p) {
              originalComposite = makeComposite(1.0F);
              isdragging = true;
              startPoint = p.getLocation();
              currentPoint = new Point(p.x+1,p.y+1);
         public void endDrag (Point p) {
              isdragging = false;
              if (!interuptdrag) {
                   endPoint = p.getLocation();
              else {
                   endPoint = currentPoint.getLocation();
              currentPoint = endPoint;
         public void updateDrag (Point p) {
              if (isdragging && !interuptdrag) {
                   currentPoint = p.getLocation();
         private AlphaComposite makeComposite(float alpha) {
             int type = AlphaComposite.SRC_OVER;
             return(AlphaComposite.getInstance(type, alpha));
         public void paintComponent (Graphics g) {
              if (currentPoint != null && startPoint != null) {
                   if (this.oldLocation != null && this.oldDimension != null) {
                        g.clearRect(oldLocation.x,oldLocation.y,oldDimension.width,oldDimension.height);
                   Graphics2D g2d = (Graphics2D)g;
                   if (this.oldLocation != null && this.oldDimension != null) {
                        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
                        Rectangle2D rect = new Rectangle(oldLocation.x,oldLocation.y,oldDimension.width,oldDimension.height);
                        g2d.fill(rect);
    //                    g2d.clearRect(oldLocation.x,oldLocation.y,oldDimension.width,oldDimension.height);
                   g2d.setPaint(new Color(0x5574B9));
                   g2d.setComposite(makeComposite(0.2F));
                   Point paintPoint;
                   Dimension size;
                   if (((currentPoint.x-startPoint.x) > 0) && ((currentPoint.y - startPoint.y) > 0)) {
                        size = new Dimension((currentPoint.x-startPoint.x), (currentPoint.y-startPoint.y));
                        paintPoint = startPoint;
                   else {
                        int altwidth = currentPoint.x-startPoint.x, altheight = currentPoint.y-startPoint.y, drawx = startPoint.x, drawy = startPoint.y;
                        if ((currentPoint.x-startPoint.x) < 0) {
                             altwidth = startPoint.x-currentPoint.x;
                             drawx = currentPoint.x;
                        if ((currentPoint.y - startPoint.y) < 0) {
                             altheight = startPoint.y-currentPoint.y;
                             drawy = currentPoint.y;
                        paintPoint = new Point(drawx,drawy);
                        size = new Dimension(altwidth,altheight);
                   location = paintPoint.getLocation();
                   dimension = size.getSize();
                   oldLocation = location.getLocation();
                   oldDimension = dimension.getSize();
                   Rectangle rect = new Rectangle(paintPoint, size);
                   g2d.fill(rect);
                   g2d.setPaint(new Color(0x5574B9));
                   g2d.setComposite(originalComposite);
                   g2d.draw(rect);
                   g2d.drawImage(image,0,0,pane);
                   g2d.dispose();
    }I really have no idea what else to try now. I'm out of options. Can anyone help here?

    import java.awt.AlphaComposite;
    import java.awt.Color;
    import java.awt.Composite;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GraphicsConfiguration;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.RenderingHints;
    import java.awt.geom.Rectangle2D;
    import java.awt.image.BufferedImage;
    import java.awt.*;
    import java.awt.event.MouseEvent;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class SP extends JPanel {
        private DragableSelection selection;
        public SP () {
    //        this.setVisible(false);
            this.setOpaque(true);
            selection = new DragableSelection(this);
            addMouseListener(tester);
            addMouseMotionListener(tester);
        public void startDrag (Point p) {
            selection.startDrag(p);
        public void endDrag (Point p) {
            selection.endDrag(p);
        public void updateDrag (Point p) {
            selection.updateDrag(p);
    //        this.paintComponent(this.getGraphics());
            // this is how we ask this component to paint itself
            repaint();
        public DragableSelection getSelection () {
            return selection;
        protected void paintComponent (Graphics g) {
            super.paintComponent(g);
            selection.paintComponent(g);
        private MouseInputAdapter tester = new MouseInputAdapter() {
            Point start;
            boolean dragging = false;
            final int MIN_DIST = 10;
            public void mousePressed(MouseEvent e) {
                start = e.getPoint();
            public void mouseReleased(MouseEvent e) {
                dragging = false;
                endDrag(e.getPoint());
            public void mouseDragged(MouseEvent e) {
                Point p = e.getPoint();
                if(start.distance(p) > MIN_DIST && !dragging) {
                    startDrag(p);
                    dragging = true;
                    System.out.printf("p %s%n", p);
                if(dragging)
                    updateDrag(p);
        public static void main(String[] args) {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new SP());
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class DragableSelection {
        private boolean isdragging = false, interuptdrag = false;
        private Point startPoint, endPoint, currentPoint, location;
        private Point oldLocation;
        private Dimension oldDimension;
        private Dimension dimension;
        private Composite originalComposite;
        private BufferedImage image;
        private SP pane;
        public DragableSelection (SP pane) {
            this.pane = pane;
        public void interruptDragging () {
            interuptdrag = true;
        public void resumeDragging () {
            interuptdrag = false;
        public Point getStartPoint () {
            return startPoint;
        public Point getLocation () {
            return location;
        public Point getEndPoint () {
            return endPoint;
        public Dimension getDimension () {
            return dimension;
        public void startDrag (Point p) {
            originalComposite = makeComposite(1.0F);
            isdragging = true;
            startPoint = p.getLocation();
            currentPoint = new Point(p.x+1,p.y+1);
        public void endDrag (Point p) {
            isdragging = false;
            if (!interuptdrag) {
                endPoint = p.getLocation();
            else {
                endPoint = currentPoint.getLocation();
            currentPoint = endPoint;
        public void updateDrag (Point p) {
            if (isdragging && !interuptdrag) {
                currentPoint = p.getLocation();
        private AlphaComposite makeComposite(float alpha) {
            int type = AlphaComposite.SRC_OVER;
            return(AlphaComposite.getInstance(type, alpha));
        public void paintComponent (Graphics g) {
            if (currentPoint != null && startPoint != null) {
                if (this.oldLocation != null && this.oldDimension != null) {
                    g.clearRect(oldLocation.x,oldLocation.y,
                                oldDimension.width,oldDimension.height);
                Graphics2D g2d = (Graphics2D)g;
                if (this.oldLocation != null && this.oldDimension != null) {
                    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, 1.0f));
                    Rectangle2D rect = new Rectangle(oldLocation.x,oldLocation.y,
                                                     oldDimension.width,oldDimension.height);
                    g2d.setPaint(g2d.getBackground());
                    g2d.fill(rect);
    //              g2d.clearRect(oldLocation.x,oldLocation.y,
    //                            oldDimension.width,oldDimension.height);
                g2d.setPaint(new Color(0x5574B9));
                g2d.setComposite(makeComposite(0.2F));
                Point paintPoint;
                Dimension size;
                if (((currentPoint.x-startPoint.x) > 0) &&
                    ((currentPoint.y - startPoint.y) > 0)) {
                    size = new Dimension((currentPoint.x-startPoint.x),
                                         (currentPoint.y-startPoint.y));
                    paintPoint = startPoint;
                else {
                    int altwidth = currentPoint.x-startPoint.x,
                                   altheight = currentPoint.y-startPoint.y,
                                   drawx = startPoint.x, drawy = startPoint.y;
                    if ((currentPoint.x-startPoint.x) < 0) {
                        altwidth = startPoint.x-currentPoint.x;
                        drawx = currentPoint.x;
                    if ((currentPoint.y - startPoint.y) < 0) {
                        altheight = startPoint.y-currentPoint.y;
                        drawy = currentPoint.y;
                    paintPoint = new Point(drawx,drawy);
                    size = new Dimension(altwidth,altheight);
                location = paintPoint.getLocation();
                dimension = size.getSize();
                oldLocation = location.getLocation();
                oldDimension = dimension.getSize();
                Rectangle rect = new Rectangle(paintPoint, size);
                g2d.fill(rect);
                g2d.setPaint(new Color(0x5574B9));
                g2d.setComposite(originalComposite);
                g2d.draw(rect);
    //            g2d.drawImage(image,0,0,pane);
    //            g2d.dispose();
    }

  • Problem using integrated WLS in jDeveloper 11.1.2.1.0

    Hey there,
    I got a problem using the integrated WLS from the jDeveloper 11.1.2.1.0.
    After trying to deploy an ADF Web Application on the integrated WLS, I get the following log message:
    LOG
    +[Waiting for the domain to finish building...]+
    +[11:26:04 AM] Creating Integrated Weblogic domain...+
    +[11:28:13 AM] Extending Integrated Weblogic domain...+
    +[11:30:06 AM] Integrated Weblogic domain processing completed successfully.+
    *** Using HTTP port 7101 ***
    *** Using SSL port 7102 ***
    +/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/bin/startWebLogic.sh+
    +[waiting for the server to complete its initialization...]+
    +.+
    +.+
    JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m  -XX:MaxPermSize=512m
    +.+
    WLS Start Mode=Development
    +.+
    CLASSPATH=/home/robin/bin/wls/oracle_common/modules/oracle.jdbc_11.1.1/ojdbc6dms.jar:/home/robin/bin/wls/patch_wls1211/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/robin/bin/wls/patch_oepe100/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/robin/bin/wls/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/robin/bin/wls/jdk160_29/lib/tools.jar:/home/robin/bin/wls/wlserver_12.1/server/lib/weblogic_sp.jar:/home/robin/bin/wls/wlserver_12.1/server/lib/weblogic.jar:/home/robin/bin/wls/modules/features/weblogic.server.modules_12.1.1.0.jar:/home/robin/bin/wls/wlserver_12.1/server/lib/webservices.jar:/home/robin/bin/wls/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/robin/bin/wls/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/home/robin/bin/wls/oracle_common/modules/oracle.jrf_11.1.1/jrf.jar:/home/robin/bin/wls/wlserver_12.1/common/derby/lib/derbyclient.jar:/home/robin/bin/wls/wlserver_12.1/server/lib/xqrl.jar
    +.+
    PATH=/home/robin/bin/wls/wlserver_12.1/server/bin:/home/robin/bin/wls/modules/org.apache.ant_1.7.1/bin:/home/robin/bin/wls/jdk160_29/jre/bin:/home/robin/bin/wls/jdk160_29/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3:/usr/games/bin
    +.+
    +*  To start WebLogic Server, use a username and   *+
    +*  password assigned to an admin-level user.  For *+
    +*  server administration, use the WebLogic Server *+
    +*  console at http://hostname:port/console        *+
    starting weblogic with Java version:
    java version "1.6.0_29"
    Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
    Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode)
    Starting WLS with line:
    +/home/robin/bin/wls/jdk160_29/bin/java -client -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=512m -Dweblogic.Name=DefaultServer -Djava.security.policy=/home/robin/bin/wls/wlserver_12.1/server/lib/weblogic.policy -Djavax.net.ssl.trustStore=/tmp/trustStore7618453572230021232.jks -Dhttp.proxyHost=emea-proxy.uk.oracle.com -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=localhost|localhost.localdomain|127.0.0.1|::1|MUELLER-BADY-GENTOO|MUELLER-BADY-GENTOO -Dhttps.proxyHost=emea-proxy.uk.oracle.com -Dhttps.proxyPort=80 -Doracle.jdeveloper.adrs=true -Dweblogic.nodemanager.ServiceEnabled=true -Xverify:none -Djava.endorsed.dirs=/home/robin/bin/wls/jdk160_29/jre/lib/endorsed:/home/robin/bin/wls/wlserver_12.1/endorsed -da -Dplatform.home=/home/robin/bin/wls/wlserver_12.1 -Dwls.home=/home/robin/bin/wls/wlserver_12.1/server -Dweblogic.home=/home/robin/bin/wls/wlserver_12.1/server -Djps.app.credential.overwrite.allowed=true -Dcommon.components.home=/home/robin/bin/wls/oracle_common -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain -Djrockit.optfile=/home/robin/bin/wls/oracle_common/modules/oracle.jrf_11.1.1/jrocket_optfile.txt -Doracle.server.config.dir=/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/config/fmwconfig/servers/DefaultServer -Doracle.domain.config.dir=/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/config/fmwconfig -Digf.arisidbeans.carmlloc=/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/config/fmwconfig/carml -Digf.arisidstack.home=/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/config/fmwconfig/arisidprovider -Doracle.security.jps.config=/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/config/fmwconfig/jps-config.xml -Doracle.deployed.app.dir=/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/servers/DefaultServer/tmp/_WL_user -Doracle.deployed.app.ext=/- -Dweblogic.alternateTypesDirectory=/home/robin/bin/wls/oracle_common/modules/oracle.ossoiap_11.1.1,/home/robin/bin/wls/oracle_common/modules/oracle.oamprovider_11.1.1 -Djava.protocol.handler.pkgs=oracle.mds.net.protocol -Dweblogic.jdbc.remoteEnabled=false -Dwsm.repository.path=/home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/oracle/store/gmds -Dweblogic.management.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=/home/robin/bin/wls/patch_wls1211/profiles/default/sysext_manifest_classpath:/home/robin/bin/wls/patch_oepe100/profiles/default/sysext_manifest_classpath:/home/robin/bin/wls/patch_ocp371/profiles/default/sysext_manifest_classpath weblogic.Server+
    +<Feb 10, 2012 11:30:09 AM CET> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true>+
    +<Feb 10, 2012 11:30:10 AM CET> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true>+
    +<Feb 10, 2012 11:30:11 AM CET> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 20.4-b02 from Sun Microsystems Inc..>+
    +<Feb 10, 2012 11:30:12 AM CET> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.1.1.0 Wed Dec 7 08:40:57 PST 2011 1445491 >+
    +<Feb 10, 2012 11:30:15 AM CET> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.>+
    +<Feb 10, 2012 11:30:15 AM CET> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.>+
    +<Feb 10, 2012 11:30:15 AM CET> <Notice> <Log Management> <BEA-170019> <The server log file /home/robin/.jdeveloper/system11.1.2.1.38.60.81/DefaultDomain/servers/DefaultServer/logs/DefaultServer.log is opened. All server side log events will be written to this file.>+
    Feb 10, 2012 11:30:24 AM oracle.security.jps.internal.keystore.file.FileKeyStoreManager saveKeyStore
    WARNING: Failed to save farm keystore. Reason {0}
    Feb 10, 2012 11:30:24 AM oracle.security.jps.internal.keystore.file.FileKeyStoreManager createKeyStore
    WARNING: Failed to save farm keystore. Reason {0}
    oracle.security.jps.service.keystore.KeyStoreServiceException: JPS-06513: Failed to save farm keystore. Reason
    +     at oracle.security.jps.internal.keystore.file.FileKeyStoreManager.createKeyStore(FileKeyStoreManager.java:309)+
    +     at oracle.security.jps.internal.keystore.file.FileKeyStoreServiceImpl.doInit(FileKeyStoreServiceImpl.java:95)+
    +     at oracle.security.jps.internal.keystore.file.FileKeyStoreServiceImpl.<init>(FileKeyStoreServiceImpl.java:73)+
    +     at oracle.security.jps.internal.keystore.file.FileKeyStoreServiceImpl.<init>(FileKeyStoreServiceImpl.java:63)+
    +     at oracle.security.jps.internal.keystore.KeyStoreProvider.getInstance(KeyStoreProvider.java:157)+
    +     at oracle.security.jps.internal.keystore.KeyStoreProvider.getInstance(KeyStoreProvider.java:64)+
    +     at oracle.security.jps.internal.core.runtime.ContextFactoryImpl.findServiceInstance(ContextFactoryImpl.java:139)+
    +     at oracle.security.jps.internal.core.runtime.ContextFactoryImpl.getContext(ContextFactoryImpl.java:170)+
    +     at oracle.security.jps.internal.core.runtime.ContextFactoryImpl.getContext(ContextFactoryImpl.java:191)+
    +     at oracle.security.jps.internal.core.runtime.JpsContextFactoryImpl.getContext(JpsContextFactoryImpl.java:132)+
    +     at oracle.security.jps.internal.core.runtime.JpsContextFactoryImpl.getContext(JpsContextFactoryImpl.java:127)+
    +     at oracle.security.jps.internal.policystore.PolicyUtil$1.run(PolicyUtil.java:850)+
    +     at oracle.security.jps.internal.policystore.PolicyUtil$1.run(PolicyUtil.java:844)+
    +     at java.security.AccessController.doPrivileged(Native Method)+
    +     at oracle.security.jps.internal.policystore.PolicyUtil.getDefaultPolicyStore(PolicyUtil.java:844)+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:291)+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:284)+
    +     at oracle.security.jps.internal.policystore.JavaPolicyProvider.<init>(JavaPolicyProvider.java:270)+
    +     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)+
    +     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)+
    +     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)+
    +     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)+
    +     at java.lang.Class.newInstance0(Class.java:355)+
    +     at java.lang.Class.newInstance(Class.java:308)+
    +     at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.loadOPSSPolicy(CommonSecurityServiceManagerDelegateImpl.java:1343)+
    +     at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1022)+
    +     at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:873)+
    +     at weblogic.security.SecurityService.start(SecurityService.java:148)+
    +     at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)+
    +     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)+
    +     at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)+
    +<Feb 10, 2012 11:30:24 AM CET> <Error> <Security> <BEA-090892> <The loading of OPSS java security policy provider failed due to exception, see the exception stack trace or the server log file for root cause. If still see no obvious cause, enable the debug flag -Djava.security.debug=jpspolicy to get more information. Error message: oracle.security.jps.JpsException: [PolicyUtil] Exception while getting default policy Provider>+
    +<Feb 10, 2012 11:30:24 AM CET> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: weblogic.security.SecurityInitializationException: The loading of OPSS java security policy provider failed due to exception, see the exception stack trace or the server log file for root cause. If still see no obvious cause, enable the debug flag -Djava.security.debug=jpspolicy to get more information. Error message: oracle.security.jps.JpsException: [PolicyUtil] Exception while getting default policy Provider+
    +weblogic.security.SecurityInitializationException: The loading of OPSS java security policy provider failed due to exception, see the exception stack trace or the server log file for root cause. If still see no obvious cause, enable the debug flag -Djava.security.debug=jpspolicy to get more information. Error message: oracle.security.jps.JpsException: [PolicyUtil] Exception while getting default policy Provider+
    +     at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.loadOPSSPolicy(CommonSecurityServiceManagerDelegateImpl.java:1402)+
    +     at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1022)+
    +     at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:873)+
    +     at weblogic.security.SecurityService.start(SecurityService.java:148)+
    +     at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)+
    +     Truncated. see log file for complete stacktrace+
    +Caused By: oracle.security.jps.JpsRuntimeException: oracle.security.jps.JpsException: [PolicyUtil] Exception while getting default policy Provider+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:293)+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:284)+
    +     at oracle.security.jps.internal.policystore.JavaPolicyProvider.<init>(JavaPolicyProvider.java:270)+
    +     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)+
    +     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)+
    +     Truncated. see log file for complete stacktrace+
    +Caused By: oracle.security.jps.JpsException: [PolicyUtil] Exception while getting default policy Provider+
    +     at oracle.security.jps.internal.policystore.PolicyUtil.getDefaultPolicyStore(PolicyUtil.java:899)+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:291)+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:284)+
    +     at oracle.security.jps.internal.policystore.JavaPolicyProvider.<init>(JavaPolicyProvider.java:270)+
    +     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)+
    +     Truncated. see log file for complete stacktrace+
    +Caused By: java.security.PrivilegedActionException: oracle.security.jps.JpsException: [PolicyUtil] Unable to obtain default JPS Context!+
    +     at java.security.AccessController.doPrivileged(Native Method)+
    +     at oracle.security.jps.internal.policystore.PolicyUtil.getDefaultPolicyStore(PolicyUtil.java:844)+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:291)+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:284)+
    +     at oracle.security.jps.internal.policystore.JavaPolicyProvider.<init>(JavaPolicyProvider.java:270)+
    +     Truncated. see log file for complete stacktrace+
    +Caused By: oracle.security.jps.JpsException: [PolicyUtil] Unable to obtain default JPS Context!+
    +     at oracle.security.jps.internal.policystore.PolicyUtil$1.run(PolicyUtil.java:860)+
    +     at oracle.security.jps.internal.policystore.PolicyUtil$1.run(PolicyUtil.java:844)+
    +     at java.security.AccessController.doPrivileged(Native Method)+
    +     at oracle.security.jps.internal.policystore.PolicyUtil.getDefaultPolicyStore(PolicyUtil.java:844)+
    +     at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:291)+
    +     Truncated. see log file for complete stacktrace+
    Caused By: oracle.security.jps.service.keystore.KeyStoreServiceException: JPS-06513: Failed to save farm keystore. Reason
    +     at oracle.security.jps.internal.keystore.file.FileKeyStoreManager.createKeyStore(FileKeyStoreManager.java:309)+
    +     at oracle.security.jps.internal.keystore.file.FileKeyStoreServiceImpl.doInit(FileKeyStoreServiceImpl.java:95)+
    +     at oracle.security.jps.internal.keystore.file.FileKeyStoreServiceImpl.<init>(FileKeyStoreServiceImpl.java:73)+
    +     at oracle.security.jps.internal.keystore.file.FileKeyStoreServiceImpl.<init>(FileKeyStoreServiceImpl.java:63)+
    +     at oracle.security.jps.internal.keystore.KeyStoreProvider.getInstance(KeyStoreProvider.java:157)+
    +     Truncated. see log file for complete stacktrace+
    +>+
    +<Feb 10, 2012 11:30:24 AM CET> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED.>+
    +<Feb 10, 2012 11:30:24 AM CET> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down.>+
    +<Feb 10, 2012 11:30:24 AM CET> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN.>+
    Process exited.
    */LOG*
    After that, I tried setting permissions for the cwallet.sso file to ugo+rwx, but this leads to the same problems as mentioned above.
    My second try was to setup an external WLS 12c, but it seems to be not yet possible to connect to a WLS 12c from within jDeveloper.
    Do you have any ideas ?
    Thank you in advance for your help.
    Regards,
    Robin

    After debugging the WLS Initialisation with jdb, I recognized that there was some trouble with dependent libraries.
    In the end, I solved my problem by using another OS (Ubuntu 11.10) for development. There, the WLS works out of the box, even with 64-Bit libraries.
    Thank you for your help.
    Regards,
    Robin

  • Could not complete the command because of a problem using the Adobe Color Engine

    Hi all
    This bizarrely started this morning - completely out of the blue - and I've no idea why.
    Setup: Mac 10.8.2 / Creative Suite Premium PhotoShop CS5 extended (patched to 12.04)
    Am working on images exported from LightRoom 4 (16bit A3 Pro Photo RGB PSDs) in PhotoShop CS5.
    As part of my image grading process I have a PhotoShop Action that does the following: copy layer to new document (document respects all of copied layer settings) > Image > Adjustments > HDR toning > apply a certain HDR preset > copy to resultant image back to original doc > set opacity as 40%.
    Totally out of the blue, after having this action for about 2 months, this morning I start getting a warning dialog of "Could not complete the command because of a problem using the Adobe Color Engine" and the action fails. The failure seems to take place at the 'make document' part of the action and seems to somehow be related to the contents of the clipboard.
    I've tried trashing and re-creating the action. It works first time out fine and then - on the next image - errors again.
    At present I can only safely carry out the work 'manually' by completing all the actions myself.
    I can think of no settings that have changed and the OS hasn't been updated in a while.
    I have found one other thread on a similar problem in PhotoShop Elements, but no definitive solution.
    Any help appreciated as I have a shedload of stuff to process.
    Best wishes
    TP

    OK: trash of prefs didn't work. Tried thrice. Re-created orig action. same problem.
    BUT!
    Your 'Image > Duplicate' suggestion does seem to work. If I use that in a new action as the method for creating the HDR version doc (instead of 'Select > Copy > New > Paste), it seems to work.
    Will try that out this afternoon, but for now: WIN!
    Many thanks for the suggestion!
    TP

  • Problems with extended features.  I can no longer fill out my documents in the fields provided.  The

    Problems with extended features.  I can no longer fill out my documents in the fields provided.  The error message I get is "This document enabled extended features in Adobe Reader.  The document has been changed since it was created and use of extended features is no longer available.  Please contact the author for original version of this document."

    Yes.  I don't have the version you pay for.  I also tried the free version
    of EchoSign.  Maybe that caused the problem.
    Any more suggestions would be greatly appreciated.
    Estelle Oliansky
    Estelle OlianskyRealtor, SRESCell (734) 748-2329
    *3DX Real Estate *| www.3dxonline.com* | (v) 888.304.1447 ext.
    102 | (f) 888.304.1456 | 42705 Grand River Ave. Ste. 201 | Novi, MI 48375*
    P Please consider the environment before printing this e-mail
    This electronic mail message and any attachments contain information
    that(a) is or may be LEGALLY PRIVILEGED, CONFIDENTIAL, PROPRIETARY IN
    NATURE, OR OTHERWISE PROTECTED BY LAW FROM DISCLOSURE, and (b) is intended
    only for the use of the Addressee(s) named herein.  If you are not the
    intended recipient, an addressee, you are hereby notified that reading,
    using, copying, or distributing any part of this message or any information
    transmitted herewith is strictly prohibited.  If you have received this
    electronic mail message in error, please contact us immediately and take
    the steps necessary to delete the message completely from  your computer
    system.

Maybe you are looking for