Extending JPanel changes JPanel behavior

All,
I am trying to center a JPanel in the middle of my JFrame. Below is the code I use to center the JPanel. What is confusing me is that when the panel in question, actionPnl, is declared as a JPanel, the centering code works beautifully. When I declare it as a CanvasPanel (see code below) it does not show up at all. Now, I thought that when you use �Extends� that the class you are creating inherits all attributes of the class you are extending however this behavior suggests otherwise. Am I overlooking some fundamental ingredient?
//private CanvasPanel actionPnl = new CanvasPanel();
private JPanel actionPnl = new JPanel();
private Box xp = Box.createHorizontalBox();
private Box yp = Box.createVerticalBox();
private void center()
  xp.add(Box.createHorizontalGlue());
  xp.add(actionPnl);
  xp.add(Box.createHorizontalGlue());
  yp.add(Box.createVerticalGlue());
  yp.add(xp);
  yp.add(Box.createVerticalGlue());
}//end center()
public class CanvasPanel extends JPanel
  private Image image;
public CanvasPanel()
   setBackground (Color.WHITE);
   setPreferredSize(new Dimension(600, 100));
}//end constructor CanvasPanel()
public void paintComponent(Graphics g)
   g.drawImage(image, 0, 0, null);
   g.dispose();
public void setImage(Image inImage)
   image = inImage;
}

We never want to see you entire program. We only want
to see the code that demonstrates the incorrect
behaviourI pieced this together and it has the same behavior. It is what I would call "hack code" and does not follow good practices. But it gets the point across. Just toggle which actionPnl declaration to comment out to see the difference.
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.image.BufferedImage;
import java.awt.Graphics;
public class test extends JFrame
Container c;
boolean btnControl = false;
/******** toggle these two *********/
//private CanvasPanel actionPnl = new CanvasPanel();
private JPanel actionPnl = new JPanel();
private Box xp = Box.createHorizontalBox();
private Box yp = Box.createVerticalBox();
public test()
//container
c = getContentPane();
c.setBackground(Color.BLACK);
c.setLayout(new BorderLayout());
//construction
buildActionPnl();
//add to JFrame
c.add(yp, BorderLayout.CENTER);
setSize(1200, 950);
setVisible(true);     
}//end constructor balance()
private void buildActionPnl()
  center();
}//end buildActionPnl()
private void center()
  xp.add(Box.createHorizontalGlue());
  xp.add(actionPnl);
  xp.add(Box.createHorizontalGlue());
  yp.add(Box.createVerticalGlue());
  yp.add(xp);
  yp.add(Box.createVerticalGlue());
}//end center()
public static void main(String args[])
  test t = new test();
t.addWindowListener(
            new WindowAdapter(){
                 public void windowClosing(WindowEvent we){
                      System.exit(0);
public class CanvasPanel extends JPanel
  private Image image;
public CanvasPanel()
   setBackground (Color.WHITE);
   setPreferredSize(new Dimension(600, 100));
}//end constructor CanvasPanel()
public void paintComponent(Graphics g)
   g.drawImage(image, 0, 0, null);
   g.dispose();
}I will research your suggested LayoutManager information and get back with how it works for me. At the moment I do not have code to control where each image is painted, that is what I am trying to take on.
Thanks for the help, it is appreciated!

Similar Messages

  • Changing JPanel with button click.

    Hi, I have a class call TOC(Table of Content) which contains all the buttons. One class call MainController. All buttons I add an actionListener which the MainController class will handle. Anothe class which is the main one which contain a JPanel.
    When I click on the button in TOC class, it will go through the MainController class and display the respective JPanel associate with the button.
    Now the problem is how do I change the JPanel in the main class with a click on the button in TOC class?
    Please advise. Thanks in advance.

    Not sure what you mean exactly. However,
    Assuming that your view class is a JPanel, when you create your controller,
    ViewPanel view = new ViewPanel();
    MainController controller = new MainController(viewPanel);
    In MainController track a reference to your viewPanel. Also in viewPanel have a method called setCurrentPanel(JPanel panel). then int he controller's action listener
    public void actionPerformed(ActionEvent ev) {
    JPanel pnl = (JPanel) panelMap.get(ev.getSource().getName());
    viewPanel.setCurrentPanel(pnl);
    I am assuming you have a way of mapping each button to the panel it will use, which is what is in the panelMap. The viewPanel can have a CardPanel layout for the panels it displays and its setCurrentPanel, can bring to front/oradd the specified panel.
    Good luck, hope this helps :-)

  • JPanel change

    In my program a certain JPanel changes as the user changes between JDialogs.
    To remove the panel, I am calling remove() within the JPanel containing it, giving a reference to the JPanel that is being removed. This seems to work fine.
    Then, to add the new JPanel, I call add() and pass in a reference to the new JPanel and its position (BorderLayout.CENTER).
    The problem is that this new panel does not show until I resize the overall JFrame containing it. This strikes me as a very strange problem. Is there a method I need to call when changing JPanels in this
    manner?
    Thanks,

    Hi nusnus,
    Pleaseo add below two lines to your code after you add new JPanel to it.
    code:
    ========
    fs.invalidate();
    fs.validate();
    fs is the container .
    I hope this will help you out.
    Regards,
    Tirumalarao
    Developer Technical Support,
    Sun Microsystems,
    http://www.sun.com/developers/support.

  • HELP!!!  Adding JPanel to JPanel (long code sample)

    I need some help here. I have been stuck on this for more time than I care to admit. Now this project is due by Monday(tomorrow)! Why does the graph not appear in the tabbed pane "trend report"?? the TrendReport class on line 2131 creates the graph. Line 56 creates an instance. and line 831 adds it to the tabbed pane. everything shows up except the graph.
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.text.*;
    import java.util.*;
    import java.lang.*;
    import javax.swing.JPopupMenu;
    import javax.swing.JPanel;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JLabel;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextField;
    import javax.swing.JTable;
    import javax.swing.filechooser.*;
    /*<br>
    *A332IWon Class<br>
    *CIS 32 / Cuesta College<br>
    *Assignment     3<br>
    *Due Date 10-08-03<br>
    *<br>
    *<br>
    *<br> >>>>>>>>> Start filling in your class discription here <<<<<<<<<<<<
            >>>>>>>>> And Start filling in your method discriptions <<<<<<<<<<<
    *<br>
    *<br>@author<br>
    *Chris Hoffman, Michael Krempely, Rudy Kalnin, Scott Thayer and Frank Randise<br>
    *@version 10.16<br>
    *<br>
    *<br>
    public class A332IWon extends JFrame
         * Class to handle all data input, output, sorting and display handling.
        private A332IWonEngine engine = new A332IWonEngine();
          * Instance of the inner class "QuickTable" called "quickTabke"
         private QuickTable quickTable = new QuickTable();
          * Instance of the inner class "BasicPayTable" called "basicPayTable"
        private BasicPayTable basicPayTable = new BasicPayTable();
         * Instance of the inner class "TrendReport" called "trendReport"
        private TrendReport trendReport = new TrendReport();       
          * Container that holds all panels, labels, and text fields
         private Container c = getContentPane();
          * The menu bar at the top of the application
         private JMenuBar bar = new JMenuBar();
          * Menu bar header called "File"
         private JMenu menuFile = new JMenu("File");
          * Menu bar header called "Edit"
         private JMenu menuEdit = new JMenu("Edit");
          * Menu bar header called "Reports"
        private JMenu menuReports = new JMenu("Reports");
          * Menu bar header called "Help"
        private JMenu menuHelp = new JMenu("Help");
          * Menu item called "Import" a sub menu item of "menuFile"
         private JMenuItem fileImport = new JMenu("Import");
          * Menu item called "Employee Text File" a sub menu item of "fileImport"
          * which in turn is a sub item of "menuFile"
         private JMenuItem fileEmpTxtFile = new JMenuItem("Employee Text File");
          * Menu item called "Pay Info File" a sub menu item of "fileImport"
          * which in turn is a sub item of "menuFile"
         private JMenuItem filePayInfoFile = new JMenuItem("Pay Info File");
          * Menu item called "Open" a sub menu item of "menuFile"
           private JMenuItem fileOpen = new JMenuItem("Open");
          * Menu item called "Save" a sub menu item of "menuFile"
           private JMenuItem fileSave = new JMenuItem("Save");
          * Menu item called "Exit" a sub menu item of "menuFile"
           private JMenuItem fileExit = new JMenuItem("Exit");
          * Menu item called "Search" a sub menu item of "menuEdit"
          private JMenuItem editSearch = new JMenu("Search");
          * Menu item called "Add/Remove" a sub menu item of "menuEdit"
           private JMenuItem editAddRemove = new JMenuItem("Add/Remove");
          * Menu item called "By ID #" a sub menu item of "editSearch"
          * which in turn is a sub item of "menuEdit"
           private JMenuItem editID = new JMenuItem("By ID #");
          * Menu item called "By name" a sub menu item of "editSearch"
          * which in turn is a sub item of "menuEdit"
           private JMenuItem editName = new JMenuItem("By name");
          * Menu item called "Basic Pay" a sub menu item of "menuReports"
           private JMenuItem repBasicPay = new JMenuItem("Basic Pay");
          * Menu item called "Trend" a sub menu item of "menuReports"
           private JMenuItem repTrend = new JMenuItem("Trend");
          * Menu item called "About" a sub menu item of "menuHelp"
           private JMenuItem helpAbout = new JMenuItem("About");
          * The tabbed pane that holds our table, reports and table editing capabilities
         private JTabbedPane empInfoTabPane = new JTabbedPane();
          * Main panel located in center that holds the tabbed pane "empInfoTabPane"
         private JPanel pCenterMain = new JPanel(new FlowLayout(FlowLayout.LEFT,25,30));
          * Panel that holds the table "table"
         private JPanel pTable = new JPanel(new GridLayout(2,1));
          * Main panel that holds the Basic Pay Report(s)
         private JPanel pBasicPayRep = new JPanel(new FlowLayout(FlowLayout.CENTER,10,20));
          * Main panel that holds the Trend Report(s)
         private JPanel pTrendRep = new JPanel(new FlowLayout(FlowLayout.CENTER,10,10));
          * Panel that holds all the add/remove fields, combo boxes and buttons
         private JPanel pAddRemove = new JPanel(new GridLayout(2,1));
            * Panel and Labels for Basic Pay Report
           private JPanel pBasicPayRepMain = new JPanel(new GridLayout(2,1));
          * Holds the pBasicPayGridLeft and pBasicPayGridRight
         private JPanel pBasicPayRepBot = new JPanel(new FlowLayout(FlowLayout.CENTER));
          * Holds the labels for each report
          * Recent Pay Period Worked, Cumulative Pay, Average Pay
         private JPanel pBasicPayGridLeft = new JPanel(new FlowLayout(FlowLayout.LEFT));
          * Holds all the basic pay report information for
          * Recent Pay Period Worked, Cumulative Pay, Average Pay
         private JPanel pBasicPayGridRight = new JPanel(new FlowLayout(FlowLayout.LEFT,20,0));
          * Displays the total number of employees that worked in the current pay period
         private JLabel txtTotalAllEmployees = new JLabel("0");
          * Displays the total number of Salaried employees that worked in the current pay period
         private JLabel txtTotalSalaried = new JLabel("0");
          * Displays the total number of Hourly employees that worked in the current pay period
         private JLabel txtTotalHourly = new JLabel("0");
          * Displays the total number of Temporary employees that worked in the current pay period
         private JLabel txtTotalTemporary = new JLabel("0");
          * Displays the total number of Contract employees that worked in the current pay period
         private JLabel txtTotalContract = new JLabel("0");
          * Displays the cumulative hourly rate in the current pay period
         private JLabel txtCumHourlyRate = new JLabel("0.00");
          * Displays the cumulative hours workded in the current pay period
           private JLabel txtCumHoursWorked = new JLabel("0");
          * Displays the cumulative gross pay in the current pay period
           private JLabel txtCumGrossPay = new JLabel("0.00");
          * Displays the cumulative tax paid in the current pay period
           private JLabel txtCumTax = new JLabel("0.00");
          * Displays the cumulative net pay in the current pay period
           private JLabel txtCumNetPay = new JLabel("0.00");
          * Displays the average hourly rate in the current pay period
           private JLabel txtAvgHourlyRate = new JLabel("0.00");
          * Displays the average hours workded in the current pay period
           private JLabel txtAvgHoursWorked = new JLabel("0.0");
          * Displays the average gross pay in the current pay period
           private JLabel txtAvgGrossPay = new JLabel("0.00");
          * Displays the average tax paid in the current pay period
           private JLabel txtAvgTax = new JLabel("0.00");
          * Displays the average net pay in the current pay period
           private JLabel txtAvgNetPay = new JLabel("0.00");
          * The table "table" created in the instance "quickTable"
         private JTable table = new JTable(quickTable);
          * The table "table2" created in the instance "BasicPayTable"
         private JTable table2 = new JTable(basicPayTable);
          * Turns the table "table" into a scroll pane
        private JScrollPane scrollpane = new JScrollPane(table);
          * Turns the table "table2" into a scroll pane2
        private JScrollPane scrollpane2 = new JScrollPane(table2);
          * **** Future Button to update the employee information in "table"
        private JButton updateEmplInfo = new JButton("Update");
         * Add button to add an employee
        private JButton bAdd = new JButton("Add");
         * Remove button to remove an employee
         private JButton bRemove = new JButton("Remove");
         * Search by employee ID button
         private JButton bSearchId = new JButton("Search");
         * Search by employee name button
         private     JButton bSearchName = new JButton("Search");
         * Texfield collects an employees ID number
        private JTextField fieldID = new JTextField(6);
         * Texfield collects an employees Last name
         private JTextField fieldLastName = new JTextField(22);
         * Texfield collects an employees First name
         private JTextField fieldFirstName = new JTextField(15);
         * Texfield collects an employees Middle initial
         private JTextField fieldMiddleInitial = new JTextField(1);
         * Texfield collects an employees street address
         private JTextField fieldStreetAddress = new JTextField(22);
         * Texfield collects an employees city lived in
         private JTextField fieldCity = new JTextField(18);
         * Texfield collects an employees state lived in
         private JTextField fieldState = new JTextField(2);
         * Texfield collects an employees zip code
         private JTextField fieldZip = new JTextField(6);
         * Texfield collects an employees hourly rate
         private JTextField fieldHourlyRate = new JTextField("0.00",6);
         * Texfield collects an employees year they started working
         private JTextField fieldYYYY = new JTextField("YYYY",4);
         * Texfield collects an employees ID number to perform a search with
         private JTextField fieldSearchById = new JTextField(6);
         * Texfield collects an employees last name to perform a search with
         private JTextField fieldSearchByLast = new JTextField(22);
         * Texfield collects an employees first name to perform a search with
         private     JTextField fieldSearchByFirst = new JTextField(15);
         * Texfield collects an employees middle initial to perform a search with
         private     JTextField fieldSearchByMiddle = new JTextField(1);
          * Background color designed to mimic Microsofts's default desktop color
         private Color MS = new Color(64,128,128);
         * Color used to simulate a manilla folder
         * <br>Used on the folders
         private Color manilla = new Color(252,220,140);
         * Color a complimenting color to "manilla" and "MS"
         * <br>Used as an accent in the search frames and tabs
         private Color seaFoam = new Color(156,198,172);
         * Color a complimenting color to "manilla" and "MS"
         * <br>Used as an accent in the tabs
         private Color babyBlue = new Color(170,220,238);
         * Color a complimenting color to "manilla" and "MS"
         * <br>Used as an accent in the tabs
         private Color lightPink = new Color(255,204,207);
         * Array of Strings: the 12 months of the year
         private String [] monthMM = {"MM","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
                                             "Sep","Oct","Nov","Dec"};
         * Array of Strings: the days of the month
         private String [] dayDD = {"DD","01","02","03","04","05","06","07","08","09","10","11",
                                          "12","13","14","15","16","17","18","19","20","21","22",
                                          "23","24","25","26","27","28","29","30","31"};
         * Array of Strings: employee types
         * <br>"Salaried","Hourly","Temporary","Contract"
         private String [] emplType = {"Emp Type","Salaried","Hourly","Temporary","Contract"};
         * String holds the month by using getSelectedItem()
         private String sMonth = "";
         * String holds the day by using getSelectedItem()
         private String sDay = "";
         * String holds the entire hire date
         private String sHireDate = "";
         * String holds the entire employee address
         private String sEmpAddress = "";
         * Double the horly rate paid to an employee
         private double hourlyRate = 0.0;
         * Drop down combo box displays the months of the year
        private JComboBox listMM = new JComboBox(monthMM);
         * Drop down combo box displays the days of the month
         private JComboBox listDD = new JComboBox(dayDD);
         * Drop down combo box displays the employee types
         private JComboBox listEmplType = new JComboBox(emplType);
         private JPanel pTrendReportMain = new JPanel();
         private JPanel pTrendReport = new JPanel();
         private JPanel pTrendRepMain = new JPanel(new GridLayout(2,1));
         private JPanel pTrendBot = new JPanel(new FlowLayout(FlowLayout.CENTER));
         private JPanel pTrendGridLeft = new JPanel(new FlowLayout(FlowLayout.LEFT));
         private JPanel pTrendGridRight = new JPanel(new FlowLayout(FlowLayout.LEFT,20,0));
         private JButton button, button2;
         private JLabel []JLab = new JLabel[4];
         private JTextField titletxt;
         private JTextField []Text = new JTextField[5];
         private JTextField []labeltxt = new JTextField[5];
         private JLabel txtTrendTotalEmployees = new JLabel("0");
         private JLabel txtTrendCumHourlyRate = new JLabel("0.00");
         private JLabel txtTrendAvgHourlyRate = new JLabel("0.00");
         private JLabel txtTrendTotalSalaried = new JLabel("0");
         private JLabel txtTrendCumHoursWorked = new JLabel("0");
         private JLabel txtTrendAvgHoursWorked = new JLabel("0.0");
         private JLabel txtTrendTotalHourly = new JLabel("0");
         private JLabel txtTrendCumGrossPay = new JLabel("0.00");
         private JLabel txtTrendAvgGrossPay = new JLabel("0.00");
         private JLabel txtTrendTotalTemporary = new JLabel("0");
         private JLabel txtTrendCumTax = new JLabel("0.00");
         private JLabel txtTrendAvgTax = new JLabel("0.00");
         private JLabel txtTrendTotalContract = new JLabel("0");
         private JLabel txtTrendCumNetPay = new JLabel("0.00");
         private JLabel txtTrendAvgNetPay = new JLabel("0.00");
         //Don't know if we can use these yet
         //private JLabel lPayPeriodStart = new JLabel("YYYY MM PP");
         //private JLabel lPayPeriodEnd = new JLabel("YYYY MM PP");
          * Standard constructor
          * <br>Call the main methods required to get the application to start
         public A332IWon(String title)
              super(title);
              menuDialogBar();
              setUpPanels();
              setContainerLayout();
              listenToMenuBar();
              listenToButtons();
              addWindowListener(new CloseWindow());
          * Contains all the ActionListener events associated with the menu bar
         public void listenToMenuBar()
              fileEmpTxtFile.addActionListener(quickTable);
              filePayInfoFile.addActionListener(quickTable);
              fileOpen.addActionListener(quickTable);
              fileSave.addActionListener(quickTable);
              fileExit.addActionListener(quickTable);
              editAddRemove.addActionListener(quickTable);
              editID.addActionListener(quickTable);
              editName.addActionListener(quickTable);
              repBasicPay.addActionListener(quickTable);
              repTrend.addActionListener(quickTable);
              helpAbout.addActionListener(quickTable);
          * Contains all ActionListener events associated with buttons and combo boxes
         public void listenToButtons()
              bAdd.addActionListener(quickTable);
              bRemove.addActionListener(quickTable);
              listMM.addActionListener(quickTable);
              listDD.addActionListener(quickTable);
              listEmplType.addActionListener(quickTable);
              bSearchId.addActionListener(quickTable);
              bSearchName.addActionListener(quickTable);
          * Contains the menu bar, the menus, and all the sub menu items
         public void menuDialogBar()
               JLabel menuShim = new JLabel("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
                                                 + "XXXXXXXXXXXXXXXXXXXXXXx12345");
               setJMenuBar(bar);
               bar.add(menuFile);
               bar.add(menuEdit);
               bar.add(menuReports);
               bar.add(menuHelp);
               bar.add(menuShim);
               menuShim.setVisible(false);
               menuFile.add(fileImport);
               fileImport.add(fileEmpTxtFile);
               fileImport.add(filePayInfoFile);
               menuFile.add(fileOpen);
               menuFile.add(fileSave);
               menuFile.add(fileExit);
               menuEdit.add(editAddRemove);
               menuEdit.add(editSearch);
               editSearch.add(editID);
               editSearch.add(editName);
               menuReports.add(repBasicPay);
               menuReports.add(repTrend);
               menuHelp.add(helpAbout);
          * Sets the layout for the container "c" and sets pCenterMain centered in "c"
         public void setContainerLayout()
              c.setLayout(new BorderLayout());
              c.add(pCenterMain, "Center");
          * Sets up the main panels needed at run time
         public void setUpPanels()
              centerMainPanel();
              tabbedPane();
              tabPanels();
              addRemovePanel();
              basicPayReportMain();
              trendReportMain();
          * Sets up the main panel with the tabbed pane "empInfoTabPane"
         public void centerMainPanel()
              pCenterMain.add(empInfoTabPane);
              pCenterMain.setBackground(MS);
          * Sets up the tabbed pane with the table, and eddit block,
          * basic pay report, and trend report
         public void tabbedPane()
             empInfoTabPane.addTab("Employee Information",pTable);
             empInfoTabPane.addTab("Basic Pay Report",pBasicPayRep);
             empInfoTabPane.addTab("Trend Report",pTrendRep);
             //empInfoTabPane.setBackground(manilla);
             //empInfoTabPane.setBackgroundAt(0,manilla);
             empInfoTabPane.setBackgroundAt(0,seaFoam);
             empInfoTabPane.setBackgroundAt(1,lightPink);
             empInfoTabPane.setBackgroundAt(2,babyBlue);
             //AUTO_RESIZE_OFF
             //empInfoTabPane.setEnabledAt(0,false);
          * Sets up the panels in the tabbed pane
         public void tabPanels()
              //JLabel tabTrendRep = new JLabel("This area will show a Trend report");
             JPanel pTableTop = new JPanel(new FlowLayout(FlowLayout.CENTER,20,20));
             JPanel pTableBottom = new JPanel(new FlowLayout(FlowLayout.LEFT));
              scrollpane.setPreferredSize(new Dimension(695,185));
              scrollpane2.setPreferredSize(new Dimension(695,185));
              pTableTop.add(scrollpane);
              pTableBottom.add(pAddRemove);
              pTableTop.setBackground(manilla);
              pTableBottom.setBackground(manilla);
              pTable.add(pTableTop);
              pTable.add(pTableBottom);
              pBasicPayRep.add(pBasicPayRepMain);
             pBasicPayRep.setBackground(manilla);
             pTrendRep.add(pTrendRepMain);
             pTrendRep.setBackground(manilla);
          * Sets up the basic pay report main panel that holds the table and the bottom pay report
         public void basicPayReportMain()
              pBasicPayRepMain.add(scrollpane2);
              pBasicPayRepMain.add(pBasicPayRepBot);
              basicPayRepTotalsPanel();
          * Sets up the basic pay report grid panel under the basic pay report table.
         public void basicPayRepTotalsPanel()
              JPanel pBasicPayLeftRight = new JPanel(new FlowLayout(FlowLayout.CENTER,10,5));
                pBasicPayRepBot.add(pBasicPayLeftRight);
                pBasicPayRepBot.setBackground(manilla);
                pBasicPayLeftRight.add(pBasicPayGridLeft);
                pBasicPayLeftRight.add(pBasicPayGridRight);
                pBasicPayLeftRight.setBackground(manilla);
                basicPayGridLeft();
                basicPayGridRight();
          * Sets up the left grid of the basic pay report grid panel.
         public void basicPayGridLeft()
              JPanel pColumn1 = new JPanel(new GridLayout(10,1));
              JLabel lblTotalEmployees = new JLabel("Recent Pay Period Worked");
              JLabel lblCumulativePay = new JLabel("Cumulative Pay");
              JLabel lblAveragePay = new JLabel("Average Pay");
              JLabel lblShim1 = new JLabel("X");
              JLabel lblShim2 = new JLabel("X");
              JLabel lblShim3 = new JLabel("X");
              lblShim1.setForeground(manilla);
              lblShim2.setForeground(manilla);
              lblShim3.setForeground(manilla);
              pColumn1.add(lblTotalEmployees);
              pColumn1.add(lblShim1);
              pColumn1.add(new JLabel(" "));
              pColumn1.add(new JLabel(" "));
              pColumn1.add(lblCumulativePay);
              pColumn1.add(lblShim2);
              pColumn1.add(new JLabel(" "));
              pColumn1.add(new JLabel(" "));
              pColumn1.add(lblAveragePay);
              pColumn1.add(lblShim3);
              pColumn1.setBackground(manilla);
              lblTotalEmployees.setForeground(Color.black);
              lblCumulativePay.setForeground(Color.black);
              lblAveragePay.setForeground(Color.black);
              pBasicPayGridLeft.add(pColumn1);
              pBasicPayGridLeft.setBackground(manilla);
          * Sets up the right grid of the basic pay report grid panel.
          * <br>This is one narly method
         public void basicPayGridRight()
              JPanel pColumn1 = new JPanel(new GridLayout(10,1));
              JPanel pColumn2 = new JPanel(new GridLayout(10,1));
              JPanel pColumn3 = new JPanel(new GridLayout(10,1));
              JPanel pColumn4 = new JPanel(new GridLayout(10,1));
              JPanel pColumn5 = new JPanel(new GridLayout(10,1));
                JLabel lblTotalEmployees = new JLabel("Employees");
                JLabel lblTotalSalaried = new JLabel("Salaried");
                JLabel lblTotalHourly = new JLabel("Hourly");
                JLabel lblTotalTemporary = new JLabel("Temporary");
                JLabel lblTotalContract = new JLabel("Contract");
                JLabel lblCumHourlyRate = new JLabel("Pay Rate");
                JLabel lblCumHoursWorked = new JLabel("Hours Worked");
                JLabel lblCumGrossPay = new JLabel("Gross Pay");
                JLabel lblCumTax = new JLabel("Flat Tax 15%");
                JLabel lblCumNetPay = new JLabel("Net Pay");
                JLabel lblAvgHourlyRate = new JLabel("Pay Rate");
                JLabel lblAvgHoursWorked = new JLabel("Hours Worked");
                JLabel lblAvgGrossPay = new JLabel("Gross Pay");
                JLabel lblAvgTax = new JLabel("Flat Tax 15%");
                JLabel lblAvgNetPay = new JLabel("Net Pay");
              pColumn1.add(lblTotalEmployees);
              pColumn1.add(txtTotalAllEmployees);
              pColumn1.add(new JLabel(" "));
              pColumn1.add(new JLabel(" "));
              pColumn1.add(lblCumHourlyRate);
              pColumn1.add(txtCumHourlyRate);
              pColumn1.add(new JLabel(" "));
              pColumn1.add(new JLabel(" "));
              pColumn1.add(lblAvgHourlyRate);
              pColumn1.add(txtAvgHourlyRate);
              pColumn1.setBackground(manilla);
              lblTotalEmployees.setForeground(Color.black);
              txtTotalAllEmployees.setForeground(Color.black);
              lblCumHourlyRate.setForeground(Color.black);
              txtCumHourlyRate.setForeground(Color.black);
              lblAvgHourlyRate.setForeground(Color.black);
              txtAvgHourlyRate.setForeground(Color.black);
              pColumn2.add(lblTotalSalaried);
              pColumn2.add(txtTotalSalaried);
              pColumn2.add(new JLabel(" "));
              pColumn2.add(new JLabel(" "));
              pColumn2.add(lblCumHoursWorked);
              pColumn2.add(txtCumHoursWorked);
              pColumn2.add(new JLabel(" "));
              pColumn2.add(new JLabel(" "));
              pColumn2.add(lblAvgHoursWorked);
              pColumn2.add(txtAvgHoursWorked);
              pColumn2.setBackground(manilla);
              lblTotalSalaried.setForeground(Color.black);
              txtTotalSalaried.setForeground(Color.black);
              lblCumHoursWorked.setForeground(Color.black);
              txtCumHoursWorked.setForeground(Color.black);
              lblAvgHoursWorked.setForeground(Color.black);
              txtAvgHoursWorked.setForeground(Color.black);
              pColumn3.add(lblTotalHourly);
              pColumn3.add(txtTotalHourly);
              pColumn3.add(new JLabel(" "));
              pColumn3.add(new JLabel(" "));
              pColumn3.add(lblCumGrossPay);
              pColumn3.add(txtCumGrossPay);
              pColumn3.add(new JLabel(" "));
              pColumn3.add(new JLabel(" "));
              pColumn3.add(lblAvgGrossPay);
              pColumn3.add(txtAvgGrossPay);
              pColumn3.setBackground(manilla);
              lblTotalHourly.setForeground(Color.black);
              txtTotalHourly.setForeground(Color.black);
              lblCumGrossPay.setForeground(Color.black);
              txtCumGrossPay.setForeground(Color.black);
              lblAvgGrossPay.setForeground(Color.black);
              txtAvgGrossPay.setForeground(Color.black);
              pColumn4.add(lblTotalTemporary);
              pColumn4.add(txtTotalTemporary);
              pColumn4.add(new JLabel(" "));
              pColumn4.add(new JLabel(" "));
              pColumn4.add(lblCumTax);
              pColumn4.add(txtCumTax);
              pColumn4.add(new JLabel(" "));
              pColumn4.add(new JLabel(" "));
              pColumn4.add(lblAvgTax);
              pColumn4.add(txtAvgTax);
              pColumn4.setBackground(manilla);
              lblTotalTemporary.setForeground(Color.black);
              txtTotalTemporary.setForeground(Color.black);
              lblCumTax.setForeground(Color.black);
              txtCumTax.setForeground(Color.black);
              lblAvgTax.setForeground(Color.black);
              txtAvgTax.setForeground(Color.black);
              pColumn5.add(lblTotalContract);
              pColumn5.add(txtTotalContract);
              pColumn5.add(new JLabel(" "));
              pColumn5.add(new JLabel(" "));
              pColumn5.add(lblCumNetPay);
              pColumn5.add(txtCumNetPay);
              pColumn5.add(new JLabel(" "));
              pColumn5.add(new JLabel(" "));
              pColumn5.add(lblAvgNetPay);
              pColumn5.add(txtAvgNetPay);
              pColumn5.setBackground(manilla);
              lblTotalContract.setForeground(Color.black);
              txtTotalContract.setForeground(Color.black);
              lblCumNetPay.setForeground(Color.black);
              txtCumNetPay.setForeground(Color.black);
              lblAvgNetPay.setForeground(Color.black);
              txtAvgNetPay.setForeground(Color.black);
              pBasicPayGridRight.add(pColumn1);
              pBasicPayGridRight.add(pColumn2);
              pBasicPayGridRight.add(pColumn3);
              pBasicPayGridRight.add(pColumn4);
              pBasicPayGridRight.add(pColumn5);
              pBasicPayGridRight.setBackground(manilla);
          * Sets up the trend report main panel that holds the graph and the bottom trend report
         public void trendReportMain()//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              //pTrendReportMain.add(trendReport);// changed pTrendReport to trendReport
              pTrendRepMain.add(trendReport);//changed pTrendRepMain to trendReport
              pTrendRepMain.add(pTrendBot);
              trendReportTotalsPanel();
         public void trendReportTotalsPanel()
              JPanel pTrendLeftRight = new JPanel(new FlowLayout(FlowLayout.CENTER,10,5));
                pTrendBot.add(pTrendLeftRight);
                pTrendBot.setBackground(manilla);
                pTrendLeftRight.add(pTrendGridLeft);
                pTrendLeftRight.add(pTrendGridRight);
                pTrendLeftRight.setBackground(manilla);
                trendReportLeft();
                trendReportRight();
         public void trendReportLeft()
              JPanel pColumn1 = new JPanel(new GridLayout(10,1));
              JLabel lblTotalEmployees = new JLabel("Recent Pay Period Worked");
              JLabel lblCumulativePay = new JLabel("Cumulative Pay Info");
              JLabel lblAveragePay = new JLabel("Average Pay Info");
              JLabel lblShim1 = new JLabel("X");
              JLabel lblShim2 = new JLabel("X");
              JLabel lblShim3 = new JLabel("X");
              lblShim1.setForeground(manilla);
              lblShim2.setForeground(manilla);
              lblShim3.setForeground(manilla);
              pColumn1.add(lblTotalEmployees);
              pColumn1.add(lblShim1);
              pColumn1.add(new JLabel(" "));
              pColumn1.add(new JLabel(" "));
              pColumn1.add(lblCumulativePay);
              pColumn1.add(lblShim2);
              pColumn1.add(new JLabel(" "));
              pColumn1.add(new JLabel(" "));
              pColumn1.add(lblAveragePay);
              pColumn1.add(lblShim3);
              pColumn1.setBackground(manilla);
              lblTotalEmployees.setForeground(Color.black);
              lblCumulativePay.setForeground(Color.black);
              lblAveragePay.setForeground(Color.black);
              pTrendGridLeft.add(pColumn1);
              pTrendGridLeft.setBackground(manilla);
         public void trendReportRight()
              JPanel pColumn1 = new JPanel(new GridLayout(10,1));
              JPanel pColumn2 = new JPanel(new GridLayout(10,1));
              JPanel pColumn3 = new JPanel(new GridLayout(10,1));
              JPanel pColumn4 = new JPanel(new GridLayout(10,1));
              JPanel pColumn5 = new JPanel(new GridLayout(10,1));
                JLabel lblTotalEmployees = new JLabel("Employees");
                JLabel lblTotalSalaried = new JLabel("Salaried");
                JLabel lblTotalHourly = new JLabel("Hourly");
                JLabel lblTotalTemporary = new JLabel("Temporary");
                JLabel lblTotalContract = new JLabel("Contract");
                JLabel lblCumHourlyRate = new JLabel("Pay Rate");
                JLabel lblCumHoursWorked = new JLabel("Hours Worked");
                JLabel lblCumGrossPay = new JLabel("Gross Pay");
                JLabel lblCumTax = new JLabel("Flat Tax 15%");
                JLabel lblCumNetPay = new JLabel("Net Pay");
                JLabel lblAvgHourlyRate = new JLabel("Pay Rate");
                JLabel lblAvgHoursWorked = new JLabel("Hours Worked");
                JLabel lblAvgGrossPay = new JLabel("Gross Pay");
                JLabel lblAvgTax = new JLabel("Flat Tax 15%");
                JLabel lblAvgNetPay = new JLabel("Net Pay");
              pColumn1.add(lblTotalEmployees);
              pColumn1.add(txtTrendTotalEmployees);     //txtTrendTotalEmployees
              pColumn1.add(new JLabel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            &n

    This class declaration won't do for loading into a JTabbedPane
    public class TrendReport extends JFrame implements ActionListener {Try this in it's place
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TrendRx {
      public static void main(String[] args) {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        TrendReport trendReport = new TrendReport();
        f.getContentPane().add(trendReport);
        f.setSize(500,300);
        f.setLocation(100,100);
        f.setVisible(true);
    class TrendReport extends JPanel implements ActionListener {
      int width;
      int height;
      JButton button;
      int []bar = new int[4];
      float []flote = {1395,1296,1402,1522};
      String []valuesInput = {"1395","1296","1402","1522"};
      String str = "", title="Title goes here";
      String []barLabels = {
        "pp01, Oct. 2003","pp02, Oct. 2003","pp01, Nov. 2003","pp02, Nov. 2003"
      String []percent = {"","","",""};
      JLabel []JLab = new JLabel[4];
      JTextField titletxt;
      JTextField []Text = new JTextField[5];
      JTextField []labeltxt = new JTextField[5];
      boolean pieChart;
      public TrendReport() {
        setOpaque(false);
        setLayout(new FlowLayout() );
        button = new JButton("Bar TrendReport");
        button.addActionListener(this);
    //    for (int k=0; k<4; k++){
    //      str = Integer.toString(k+1);
        add(button);
      public void paintComponent(Graphics g) {
        width = getWidth();
        height = getHeight();
        Graphics2D g2 = (Graphics2D)g;                    
        g2.setColor(new Color(223,222,224));
        g2.fillRect(0,0,width,height);
        g2.setColor(Color.orange);
        if(pieChart) {
          g2.fillArc(getW(30), getH(130), getW(220), getH(220), 90, -bar[0]);
          g2.fillRect(getW(270), getH(170), getW(30), getH(20));
        else
          g2.fillRect(getW(30), getH(150), getW(bar[0]), getH(30));
        g2.setColor(Color.green);
        if(pieChart) {
          g2.fillArc(getW(30), getH(130), getW(220), getH(220), 90-bar[0], -bar[1]);
          g2.fillRect(getW(270), getH(210), getW(30), getH(20));
        else
          g2.fillRect(getW(30), getH(190), getW(bar[1]), getH(30));
        g2.setColor(Color.red);
        if(pieChart) {
          g2.fillArc(getW(30), getH(130), getW(220), getH(220),
                     90-(bar[0]+bar[1]), -bar[2]);
          g2.fillRect(getW(270), getH(250), getW(30), getH(20));
        else
          g2.fillRect(getW(30), getH(230), getW(bar[2]), getH(30));
        g2.setColor(Color.blue);
        if(pieChart) {
          g2.fillArc(getW(30), getH(130), getW(220), getH(220),
                     90-(bar[0]+bar[1]+bar[2]), -bar[3]);
          g2.fillRect(getW(270), getH(290), getW(30), getH(20));
        else
          g2.fillRect(getW(30), getH(270), getW(bar[3]), getH(30));
        g2.setColor(Color.black);
        g2.setFont(new Font("Arial", Font.BOLD, 18));
        if(pieChart)
          g2.drawString(title, getW(220), getH(142));
        else
          g2.drawString(title, getW(50), getH(132));
        g2.setFont(new Font("Arial", Font.PLAIN,16));
        int temp=0;
        if(pieChart)
          temp = 185;
        else
          temp = 172;
        for(int j=0; j <4; j++) {
          if(pieChart)
            g2.drawString("$"+valuesInput[j]+" "+barLabels[j]+percent[j],
                          getW(305), getH(temp));//XXXXXXXXXXXXXXX
          else
            g2.drawString("$"+valuesInput[j]+" "+barLabels[j]+percent[j],
                          getW(bar[j]+40), getH(temp));
          temp += 40;
        if(!pieChart){
          g2.drawLine(getW(30), getH(130), getW(30), getH(300));
          g2.drawLine(getW(30), getH(300), getW(430), getH(300));               
          g2.setFont(new Font("Arial", Font.PLAIN,12));
        super.paintComponent(g2);
      private int getW(int dx) {
        return (dx * width) / 550;
      private int getH(int dy) {
        return (dy * height) / 400;
      public void actionPerformed(ActionEvent e) {
        String command = e.getActionCommand();
        if(command.equals("Bar TrendReport")){
          button.setText("Pie Chart");
          pieChart=false;
          try {
            int temp =0;
            java.text.DecimalFormat df = new java.text.DecimalFormat("#0.#");
            for (int j=0; j<4; j++){
              //flote[j] = Float.parseFloat(Text[j].getText());//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              temp += (int)((flote[j]) +0.5);
            for (int k=0; k<4; k++){
              bar[k] = (int)(((flote[k]/temp) * 360)+0.5);
              //barLabels[k] = labeltxt[k].getText();XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              flote[k] = (flote[k]/temp) *100;
              percent[k] = ": "+df.format(flote[k])+"%";
          catch(Exception message){
            title = "Oops! Complete all fields, enter numbers only";
        if(command.equals("Pie Chart")){
          button.setText("Bar TrendReport");
          pieChart=true;
        repaint();
    }

  • Problems for final year project regarding jpanel to jpanel communication

    Hi, I have some problems regarding the creation of a traffic simulator using Net beans. I have three classes for a frame and two panels, namely SimUI() which is the Frame class and TunnelPanel() which extends the panel that the road and traffic will be displayed. I have got so far only to encounter some problems regarding the event listeners which are placed in SIM UI() : The frame class. I want my buttons in one panel to paint objects which re in another panel. someone PLEASE help me as I dont have much time left. Here is my code: -
    import java.awt.Color;
    import java.awt.Event;
    import java.awt.Graphics;
    import javax.swing.JSlider;
    * SimUI.java
    * Created on 24 February 2007, 21:01
    * @author Ben Kolosz
    public class SimUI extends javax.swing.JFrame {
    /** Creates new form SimUI */
    public SimUI() {
    initComponents();
    public class TunnelPanel extends javax.swing.JPanel {
    int lineX = 0, lineY = 100;
    int lineWidth = 620;
    int lineHeight = 3;
    int line2X = 0, line2Y = 200;
    int line2Width = 620;
    int line2Height = 3;
    int line3X = 0, line3Y = 145;
    int line3Width = 620;
    int line3Height = 3;
    int line4X = 0, line4Y = 155;
    int line4Width = 620;
    int line4Height = 3;
    public void paintRoad(Graphics g) {
    g.setColor(Color.black); //Paint the Tunnel road
    g.fillRect(lineX, lineY, lineWidth, lineHeight);
    g.fillRect(line2X, line2Y, line2Width, line2Height);
    g.fillRect(line3X, line3Y, line3Width, line3Height);
    g.fillRect(line4X, line4Y, line4Width, line4Height);
    g.drawRect(line4X, line4Y, line4Width, line4Height);
    jTextArea1.repaint();
    public void setRequestFocusEnabled(boolean requestFocusEnabled) {
    public class TrafControl extends javax.swing.JPanel {
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    View = new TunnelPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTextArea1 = new javax.swing.JTextArea();
    Control = new TrafControl();
    TrafficFlowTBut = new javax.swing.JToggleButton();
    HumanBut = new javax.swing.JButton();
    AutomaticBut = new javax.swing.JButton();
    ExitBut = new javax.swing.JButton();
    FlowSlider = new javax.swing.JSlider();
    FlowLabel = new javax.swing.JLabel();
    Start = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("INTELLIGENT HIGHWAY SIMULATION v1.0");
    setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    setResizable(false);
    getAccessibleContext().setAccessibleName("Intelligent Highway Simulation");
    View.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tunnel View", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gill Sans Ultra Bold Condensed", 0, 11)));
    View.setForeground(new java.awt.Color(224, 223, 227));
    View.setOpaque(false);
    jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    jTextArea1.setColumns(20);
    jTextArea1.setEditable(false);
    jTextArea1.setRows(1);
    jTextArea1.setBorder(null);
    jTextArea1.setCaretColor(new java.awt.Color(224, 223, 227));
    jTextArea1.setOpaque(false);
    jScrollPane1.setViewportView(jTextArea1);
    jTextArea1.getAccessibleContext().setAccessibleParent(jTextArea1);
    org.jdesktop.layout.GroupLayout ViewLayout = new org.jdesktop.layout.GroupLayout(View);
    View.setLayout(ViewLayout);
    ViewLayout.setHorizontalGroup(
    ViewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
    ViewLayout.setVerticalGroup(
    ViewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, ViewLayout.createSequentialGroup()
    .addContainerGap(421, Short.MAX_VALUE)
    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    Control.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Traffic Control", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gill Sans Ultra Bold Condensed", 0, 11), new java.awt.Color(255, 51, 51)));
    TrafficFlowTBut.setLabel("Traffic Flow");
    TrafficFlowTBut.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    HumanBut.setLabel("Human Driver Mode");
    HumanBut.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    AutomaticBut.setLabel("Automatic Control");
    AutomaticBut.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    ExitBut.setLabel("Exit");
    ExitBut.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    ActionEvent(evt);
    ExitBut.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    ButtonExitButBut(evt);
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    FlowSlider.setMajorTickSpacing(60);
    FlowSlider.setMaximum(3000);
    FlowSlider.setMinorTickSpacing(30);
    FlowSlider.addChangeListener(new javax.swing.event.ChangeListener() {
    public void stateChanged(javax.swing.event.ChangeEvent evt) {
    FlowSliderStateChanged(evt);
    FlowSlider.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    FlowLabel.setLabelFor(FlowSlider);
    FlowLabel.setText("Vehicle Flow Rate: 0 p/h");
    FlowLabel.getAccessibleContext().setAccessibleName("position");
    FlowLabel.getAccessibleContext().setAccessibleDescription("position");
    Start.setText("Start");
    Start.addKeyListener(new java.awt.event.KeyAdapter() {
    public void keyTyped(java.awt.event.KeyEvent evt) {
    StartKeyTyped(evt);
    Start.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    StartMouseClicked(evt);
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    org.jdesktop.layout.GroupLayout ControlLayout = new org.jdesktop.layout.GroupLayout(Control);
    Control.setLayout(ControlLayout);
    ControlLayout.setHorizontalGroup(
    ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(ControlLayout.createSequentialGroup()
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
    .add(ControlLayout.createSequentialGroup()
    .add(HumanBut)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(AutomaticBut))
    .add(TrafficFlowTBut))
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
    .add(org.jdesktop.layout.GroupLayout.LEADING, ControlLayout.createSequentialGroup()
    .add(6, 6, 6)
    .add(Start)
    .add(28, 28, 28)
    .add(FlowLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 165, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .add(org.jdesktop.layout.GroupLayout.LEADING, ControlLayout.createSequentialGroup()
    .add(10, 10, 10)
    .add(ExitBut)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(FlowSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 187, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap(24, Short.MAX_VALUE))
    ControlLayout.setVerticalGroup(
    ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(ControlLayout.createSequentialGroup()
    .addContainerGap()
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(HumanBut)
    .add(AutomaticBut)
    .add(FlowLabel)
    .add(Start))
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(ControlLayout.createSequentialGroup()
    .add(19, 19, 19)
    .add(FlowSlider, 0, 0, Short.MAX_VALUE))
    .add(ControlLayout.createSequentialGroup()
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
    .add(ExitBut)
    .add(TrafficFlowTBut))))
    .addContainerGap())
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
    .add(org.jdesktop.layout.GroupLayout.LEADING, View, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(org.jdesktop.layout.GroupLayout.LEADING, Control, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(View, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(Control, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap())
    pack();
    }// </editor-fold>
    private void StartMouseClicked(java.awt.event.MouseEvent evt) {                                  
    private void StartKeyTyped(java.awt.event.KeyEvent evt) {                              
    // TODO add your handling code here:
    * This method is called by the thread that was created in
    * the start method. It does the main animation.
    private void ButtonExitButBut(java.awt.event.MouseEvent evt) {                                 
    System.exit(0);// TODO add your handling code here:
    private void FlowSliderStateChanged(javax.swing.event.ChangeEvent evt) {                                       
    JSlider src = (JSlider) evt.getSource();
    if(!src.getValueIsAdjusting())
    FlowLabel.setText("Vehicle Flow Rate: "+ FlowSlider.getValue() + " p/h");
    private void DescWipe(java.awt.event.MouseEvent evt) {                         
    jTextArea1.setText(null);
    jTextArea1.repaint();
    private void ButtonInfo(java.awt.event.MouseEvent evt) {                           
    if(evt.getSource() == HumanBut) jTextArea1.setText("Enables Human Reaction control variables in simulation");
    if(evt.getSource() == AutomaticBut) jTextArea1.setText("Enables Automated control variables in simulation");
    if(evt.getSource() == TrafficFlowTBut)jTextArea1.setText("Toggles between On/Off peak traffic conditions");
    if(evt.getSource() == Start)jTextArea1.setText("Starts and stops the simulation, traffic data saved to log when stopped");
    if(evt.getSource() == ExitBut)jTextArea1.setText("Exit the Program");
    if(evt.getSource() == FlowSlider)jTextArea1.setText("Adjusts the amount of traffic flowing into Tunnel");
    private void ActionEvent(java.awt.event.ActionEvent evt) {                            
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new SimUI().setVisible(true);
    private String getParameter(String string) {
    return null;
    // Variables declaration - do not modify
    private javax.swing.JButton AutomaticBut;
    private javax.swing.JPanel Control;
    private javax.swing.JButton ExitBut;
    private javax.swing.JLabel FlowLabel;
    private javax.swing.JSlider FlowSlider;
    private javax.swing.JButton HumanBut;
    private javax.swing.JButton Start;
    private javax.swing.JToggleButton TrafficFlowTBut;
    private javax.swing.JPanel View;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration
    //public declarations
    private String str;
    }

    View = new TunnelPanel();This is my panel instance which I have placed at the start of the generated code that Netbeans uses. I had to actually create custom code for this to be displayed but anyhoo I already tried that. The methodI want to call is
    public void paintRoad(Graphics g)I have already attempted to call the method from the mouseclick event listener in SIM UI:
    TunnelPanel.paintRoad(Graphics g)but a compiler error reads cannot issue a static command or something like that: -
    Here is my code formatted, hope you can help mate.:)
    import java.awt.Color;
    import java.awt.Event;
    import java.awt.Graphics;
    import javax.swing.JSlider;
    * SimUI.java
    * Created on 24 February 2007, 21:01
    * @author Ben Kolosz
    public class SimUI extends javax.swing.JFrame {
    /** Creates new form SimUI */
    public SimUI() {
    initComponents();
    public class TunnelPanel extends javax.swing.JPanel {
    int lineX = 0, lineY = 100;
    int lineWidth = 620;
    int lineHeight = 3;
    int line2X = 0, line2Y = 200;
    int line2Width = 620;
    int line2Height = 3;
    int line3X = 0, line3Y = 145;
    int line3Width = 620;
    int line3Height = 3;
    int line4X = 0, line4Y = 155;
    int line4Width = 620;
    int line4Height = 3;
    public void paintRoad(Graphics g) {
    g.setColor(Color.black); //Paint the Tunnel road
    g.fillRect(lineX, lineY, lineWidth, lineHeight);
    g.fillRect(line2X, line2Y, line2Width, line2Height);
    g.fillRect(line3X, line3Y, line3Width, line3Height);
    g.fillRect(line4X, line4Y, line4Width, line4Height);
    g.drawRect(line4X, line4Y, line4Width, line4Height);
    jTextArea1.repaint();
    public void setRequestFocusEnabled(boolean requestFocusEnabled) {
    public class TrafControl extends javax.swing.JPanel {
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    View = new TunnelPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTextArea1 = new javax.swing.JTextArea();
    Control = new TrafControl();
    TrafficFlowTBut = new javax.swing.JToggleButton();
    HumanBut = new javax.swing.JButton();
    AutomaticBut = new javax.swing.JButton();
    ExitBut = new javax.swing.JButton();
    FlowSlider = new javax.swing.JSlider();
    FlowLabel = new javax.swing.JLabel();
    Start = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("INTELLIGENT HIGHWAY SIMULATION v1.0");
    setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    setResizable(false);
    getAccessibleContext().setAccessibleName("Intelligent Highway Simulation");
    View.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tunnel View", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gill Sans Ultra Bold Condensed", 0, 11)));
    View.setForeground(new java.awt.Color(224, 223, 227));
    View.setOpaque(false);
    jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    jTextArea1.setColumns(20);
    jTextArea1.setEditable(false);
    jTextArea1.setRows(1);
    jTextArea1.setBorder(null);
    jTextArea1.setCaretColor(new java.awt.Color(224, 223, 227));
    jTextArea1.setOpaque(false);
    jScrollPane1.setViewportView(jTextArea1);
    jTextArea1.getAccessibleContext().setAccessibleParent(jTextArea1);
    org.jdesktop.layout.GroupLayout ViewLayout = new org.jdesktop.layout.GroupLayout(View);
    View.setLayout(ViewLayout);
    ViewLayout.setHorizontalGroup(
    ViewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
    ViewLayout.setVerticalGroup(
    ViewLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, ViewLayout.createSequentialGroup()
    .addContainerGap(421, Short.MAX_VALUE)
    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    Control.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Traffic Control", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gill Sans Ultra Bold Condensed", 0, 11), new java.awt.Color(255, 51, 51)));
    TrafficFlowTBut.setLabel("Traffic Flow");
    TrafficFlowTBut.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    HumanBut.setLabel("Human Driver Mode");
    HumanBut.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    AutomaticBut.setLabel("Automatic Control");
    AutomaticBut.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    ExitBut.setLabel("Exit");
    ExitBut.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    ActionEvent(evt);
    ExitBut.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    ButtonExitButBut(evt);
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    FlowSlider.setMajorTickSpacing(60);
    FlowSlider.setMaximum(3000);
    FlowSlider.setMinorTickSpacing(30);
    FlowSlider.addChangeListener(new javax.swing.event.ChangeListener() {
    public void stateChanged(javax.swing.event.ChangeEvent evt) {
    FlowSliderStateChanged(evt);
    FlowSlider.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    FlowLabel.setLabelFor(FlowSlider);
    FlowLabel.setText("Vehicle Flow Rate: 0 p/h");
    FlowLabel.getAccessibleContext().setAccessibleName("position");
    FlowLabel.getAccessibleContext().setAccessibleDescription("position");
    Start.setText("Start");
    Start.addKeyListener(new java.awt.event.KeyAdapter() {
    public void keyTyped(java.awt.event.KeyEvent evt) {
    StartKeyTyped(evt);
    Start.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(java.awt.event.MouseEvent evt) {
    StartMouseClicked(evt);
    public void mouseEntered(java.awt.event.MouseEvent evt) {
    ButtonInfo(evt);
    public void mouseExited(java.awt.event.MouseEvent evt) {
    DescWipe(evt);
    org.jdesktop.layout.GroupLayout ControlLayout = new org.jdesktop.layout.GroupLayout(Control);
    Control.setLayout(ControlLayout);
    ControlLayout.setHorizontalGroup(
    ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(ControlLayout.createSequentialGroup()
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
    .add(ControlLayout.createSequentialGroup()
    .add(HumanBut)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(AutomaticBut))
    .add(TrafficFlowTBut))
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
    .add(org.jdesktop.layout.GroupLayout.LEADING, ControlLayout.createSequentialGroup()
    .add(6, 6, 6)
    .add(Start)
    .add(28, 28, 28)
    .add(FlowLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 165, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .add(org.jdesktop.layout.GroupLayout.LEADING, ControlLayout.createSequentialGroup()
    .add(10, 10, 10)
    .add(ExitBut)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(FlowSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 187, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap(24, Short.MAX_VALUE))
    ControlLayout.setVerticalGroup(
    ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(ControlLayout.createSequentialGroup()
    .addContainerGap()
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(HumanBut)
    .add(AutomaticBut)
    .add(FlowLabel)
    .add(Start))
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(ControlLayout.createSequentialGroup()
    .add(19, 19, 19)
    .add(FlowSlider, 0, 0, Short.MAX_VALUE))
    .add(ControlLayout.createSequentialGroup()
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(ControlLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
    .add(ExitBut)
    .add(TrafficFlowTBut))))
    .addContainerGap())
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
    .add(org.jdesktop.layout.GroupLayout.LEADING, View, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .add(org.jdesktop.layout.GroupLayout.LEADING, Control, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(View, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
    .add(Control, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap())
    pack();
    }// </editor-fold>
    private void StartMouseClicked(java.awt.event.MouseEvent evt) {
    private void StartKeyTyped(java.awt.event.KeyEvent evt) {
    // TODO add your handling code here:
    * This method is called by the thread that was created in
    * the start method. It does the main animation.
    private void ButtonExitButBut(java.awt.event.MouseEvent evt) {
    System.exit(0);// TODO add your handling code here:
    private void FlowSliderStateChanged(javax.swing.event.ChangeEvent evt) {
    JSlider src = (JSlider) evt.getSource();
    if(!src.getValueIsAdjusting())
    FlowLabel.setText("Vehicle Flow Rate: "+ FlowSlider.getValue() + " p/h");
    private void DescWipe(java.awt.event.MouseEvent evt) {
    jTextArea1.setText(null);
    jTextArea1.repaint();
    private void ButtonInfo(java.awt.event.MouseEvent evt) {
    if(evt.getSource() == HumanBut) jTextArea1.setText("Enables Human Reaction control variables in simulation");
    if(evt.getSource() == AutomaticBut) jTextArea1.setText("Enables Automated control variables in simulation");
    if(evt.getSource() == TrafficFlowTBut)jTextArea1.setText("Toggles between On/Off peak traffic conditions");
    if(evt.getSource() == Start)jTextArea1.setText("Starts and stops the simulation, traffic data saved to log when stopped");
    if(evt.getSource() == ExitBut)jTextArea1.setText("Exit the Program");
    if(evt.getSource() == FlowSlider)jTextArea1.setText("Adjusts the amount of traffic flowing into Tunnel");
    private void ActionEvent(java.awt.event.ActionEvent evt) {
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new SimUI().setVisible(true);
    private String getParameter(String string) {
    return null;
    // Variables declaration - do not modify
    private javax.swing.JButton AutomaticBut;
    private javax.swing.JPanel Control;
    private javax.swing.JButton ExitBut;
    private javax.swing.JLabel FlowLabel;
    private javax.swing.JSlider FlowSlider;
    private javax.swing.JButton HumanBut;
    private javax.swing.JButton Start;
    private javax.swing.JToggleButton TrafficFlowTBut;
    private javax.swing.JPanel View;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration
    //public declarations
    private String str;
    }

  • Create Archive, how to change the behavior of the default file naming?

    From an earlier post on archiving via the contextual menu in the Mac OS X Finder:
    "If you archive a single item, the archived file has the name of the original item with a ".zip" extension. If you archive multiple items at once, the archived file is called Archive.zip."
    Is there a way to change the behavior of this?
    I ask because I want to archive a single file, say "photo.psd" and when I do I get an archive called "photo.psd.zip" - is there a way to create an archive from the contextual menu and have the original file extension be appended? - in this case I would want "photo.zip" to be the end result.
    Also, is there a way to change the behavior of archiving multiple files? To, say, create a differently named file afterwards instead of the default "Archive.zip" - perhaps something a little more descriptive but standard, like "YourFilesCompressed.zip" - something that would stay the same across each archive creation.
    Thanks, I've been manually renaming after all create-archive's. And I do realize other applications could probably do this, but I'm thinking there must be a way to do this in the finder, no? A terminal command? Any ideas would be appreciated.

    Try looking at the documentation for the ditto and zip Terminal commands.
    (14504)

  • Change the behavior for movement type 309 - Account post PRD

    Dear friends ,
    We need to transfer material to material using movement type 309.
    These material are using price control "S".
    When we transfer from material A to material B the price difference stay stopped in the PRD account.
    We need to revaluate the material B automatically and not let the price difference stopped in the PRD... when we run the Material Costs..via Material ledger.
    Does anyone knows a way to change this behavior ?
    best regards,
    Alessandro

    Dear Revi thanks for your answer !
    One more thing...
    We cannot change the valuation from S to V in the material B.
    Regarding the PRD postings... when the Controlling team runs the Material Ledger the price for material B should be changed/updated automatically, Am I right ?
    And then the PRD account must be cleared...
    Or I continue to do the MR22 manuall...or better... create an Abap program to run automatically clearing the PRD posting agains't the material via MR22 to correct the cost of this material.
    thanks once more.
    Ale

  • How to change the behavior of Named Criteria

    Dear,
    we created Named Criteria with bind viriable, then I drag as Query Panel to the page, then I drag the same VO to the page as ADF Form. in the same form I create three bottons ( Delete,Insert,Update)
    the question is when I create record in the form using Insert botton then I want to cancel this action and I want to click on search botton the from give that some fields in ADF from are requird so how to avoid that. or how can I change the behavior of search button .
    thanks,

    Thanks,
    but can you please tell me how to add the rollback in the action of search button.
    as I see I cann't find the code behinde for search button.

  • I've found that middlemouse.contentLoadURL feature has changed its behavior in FF5.0 as compared with previous versions

    I've found that middlemouse.contentLoadURL feature has changed its behavior in FF5.0 as compared with previous versions: I now can paste&load only full urls that start with "http://" prefix, but previously it was possible to paste&load any url even without protocol prefix. It is very useful when someone has an url for example just "support.mozilla.com", but with FF5.0 one _has_ to paste it to urlbar instead of just middle-clicking into the browser window (long standing and usual *nix behavior). How can I make middlemouse.contentLoadURL load any clipboard content not prefixed with protocol specification?

    Oops, already found a solution: https://support.mozilla.com/ru/questions/824759
    But, how could it be done via something less freaky (ala about:config)?

  • Changing the behavior of LOV's ...???

    Hi,
    Is it possible to change the behavior / appearance of LOV objects in Forms 6i and /or Forms10g..., or are they considered as 'black box'..????
    For example , is it possible to add two text fields in the upper side of the lov window titled as "Find" (the combination of the content of the first text field and/or the content of the second one...) , or to do the order of the displayed records dynamically as they appeared according to the first / second e.t.c. field ... or to order them in ascending or descending ....
    Thanks....
    Sim

    Hello,
    <p>This solution could show you one search direction.</p>
    Francois

  • FF4.0 wants to download a .asp page ratehr than open it. How do I change this behavior?

    I am on a OSX 10.6.7. One example of the page that I want to open is at http://tinyurl.com/3moz8fk When I click on the link, FF downloads the page. When I enter the link in Safari, it opens as expected. I don't see anywhere that I can change the behavior of the .asp documents in order to open as expected.

    I know that the doc is a PDF. Firefox isn't getting to the point of downloading the pdf, it thinks that it's supposed to d/l the ASP page.

  • Can I change the behavior of right clicks

    Some of my online emails have there own right click menus. Can I disable right Clicks in firefox while visiting these sites

    At present, it is not possible to change the behavior of a built-in entity extractor. However, if you want to cover casesthat abuilt-in extractor doesn't cover, you can add your own entity extractor.  For example, the "ordinal" built-in
    entity extractor covers "first", "second", "3rd", etc.as in "the second one in the list".  If you wanted to also detect "last" as in"the last one in the list", youcould build your own entity
    extractor that detects "last", and the check for both your entity and the built-in entity in your app.

  • When I nudge clips in Premiere CC they will "run over" other clips, how do I change this behavior so the clip will stop when it hits another clip?

    When I nudge clips in Premiere CC they will "run over" other clips, how do I change this behavior so the clip will stop when it hits another clip?

    Not sure what behavior you are exactly looking for, to move the clip and have it stop and the next clip in the direction of travel, drag the clip with the mouse with Snapping turned on in the timeline.
    MtD

  • Using ActionListener to change JPanels

    Hey,
    I'm currently writing an app which uses a set of JToggleButtons to alter the selection of a range of user interface elements on different panels. When a user selects a particular toggle button i want the panel or frame to change to a different panel or frame. Ive got all the action listeners setup and all the components added to different JPanel's at the moment.
    I just wondered if anyone knew a good way to switch between these panels before i have a go and probably do it wrong.
    Hopefully someone will be able to help!
    Thanks for any help
    Damo.

    thanks for all the replies everyone.
    i did think of using a tabbed pane to do it, but i dont really want the tabs at the top as the selected pane is dependent on a range of toggle buttons, not the actual tab selectors.
    Ill look into both of the ideas.
    Thanks again
    Damo.

  • Changing JPanels in a JSplitPane

    Hi
    I'm busy writing a swing application that consists of a JTabbedPane with each tab being a JSplitPane. Each of these JSplitPanes has a bunch of buttons on the left hand side, and pressing a button brings up a JPanel on the right hand side with the appropriate form on it. The problem is that i can bring up one panel, but the minute i click another button to bring up a different panel the application just hangs... I have no idea why.
    The code i'm using to change panels looks something like this.
    private void generalConfigPressed(java.awt.event.ActionEvent evt) {
    generalConfigPanel tmp = new generalConfigPanel();
    tmp.setCommunicator(comm);
    jSplitPane1.remove(jSplitPane1.getRightComponent());
    jSplitPane1.setRightComponent(tmp);
    generalConfigPanel is a JPanel. setCommunicator is a method i need to invoke before displaying the panel.
    I'm using j2sdk 1.4.2
    Any suggestions would be most appreciated.
    Thanks in advance
    Sebastian

    You might try making the right pane a cardstack instead of removing and adding components with each mouse click

Maybe you are looking for

  • MDB(Message Driven Bean) is not working in MDM2.0.1

    Hi, I am trying to use MDB for importing files.I followed the Weblogic_jms_Integration(1308181.1) document and i created all the xml files CM_config.xmCM_ejb-jar.xml.wls.jms_1.includel.win.exit_4.include,CM_config.xml.win.jms.include,CM_ejb-jar.xml.w

  • Need a formula for 12 months data, 6 months data and 3 month

    Hi All Crystal Experts, In my report, data is grouped by months and I have monthly view of data. I have three prompts- Year, Startdate and Enddate. If I give 2013 as year, 1/1/2013 as start date and 05/01/2013 as end date then report shows monthly vi

  • I have internet, but Safari won't open. keep getting crash reports

    I just had a new hard drive put into my macbook, I have internet connection. It is updated, I have restarted it several times too. and everytime I have clicked on Safari I get an error message that says "Safari Quit Unexpectedly" Also, I can't get my

  • Character Problem For SmartForms to Pdf .

    Hi Experts ; my problem about smartforms . I have a custumer list. I use smartform for output. Customer list of smartform ok . Have any problem . But I convert this output to PDF . Some Characters  are overlapping . My main language Türkçe(Turkish) .

  • Can't get any servers

    Our ISP was taken over by another group and we've had nothing but problems since. Presently I can get e-mail on this eMac but cannot connect to any websites. I was told by the ISP to take down the firewall, expunge a SurfBooster program they suggeste