Please Help : GUI component

My plan is to create a GUI based page-editor(html) for text(bold,italic,underline etc..), images(not creation of image, just insert) and some more basic component with limited functionalities. This contains drag&drop option also.
Hope Swing will be the best solution for this.
Can anybody please help by providing any useful information for this. No problem even if the information you have is very basic level.
Thanks in advance

Yes swing is a better idea than AWT, build a class for each type of object you want to put on the page(JLabels will be a good solution for text and images).
If you just want to move the object around the page you don't need to use DAD, implementing mousedrag will do the job.
Noah

Similar Messages

  • Please Help/ GUI Calculator

    I'm trying to create a GUI Calculator but cannot get my program to compile. Please could someone assistm, thanks.
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class CalculatorFrame extends JFrame
         private Container contentPane;
         //The componenets used in the calculator
         private JTextField display;
         private JButton addition;
         private JButton subtract;
         private JButton multiply;
         private JButton divide;
         private JButton mod;
         private JButton enter;
         private JButton [] digits;
         //End of components
         //Integer representations for the arithmetic operations needed
         private final static int ADD = 1;
         private final static int SUB = 2;
         private final static int MUL = 3;
         private final static int DIV = 4;
         private final static int MOD = 5;
         //ENd of arithmethic operations
         //Integer holding the operator that the user requested
         private int op;
         //Boolean variable to help perform the calculations
         private boolean firstFilled;
         private boolean clearScreen;
         //Constructor for the class
         public CalculatorFrame()
         contentPane=new Container();
         this.setSize(400,300); //sets the size of the frame
         this.setTitle("MIS 222 Calculator"); //sets the title of the frame
         //allows the "X" box in the upper right hand corner to close the entire application
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         contentPane=this.getContentPane(); //gets the content pane
         //Methods
         addDisplay();
         addDigits();
         addDigitActionListeners();
         addOperation();
    private void addDisplay()
         JLabel displayLab = new JLabel("Answer");
         JPanel north = new JPanel();
         north.add(displayLab);
         contentPane.add(north, "North");
    //diplay was already declared above the constructor
         display = new JTextField(25);
    //adding the components to the panel
         north.add(displayLab);
         north.add(display);
    //adding the panel to frame's content pane
         contentPane.add(north, "North");
    //Declaring the global digits array
    private void addDigits()
         //Add 1 large panel to hold the 3 inner panels
         JPanel digPanel = new JPanel();
         //Set the panel's preferred size so that it will keep everything in line
         digPanel.setPreferredSize(new Dimension(200, 275));
         //Initialize the top 3 digits' JPanel and set its preferrd size
         JPanel topDigits = new JPanel();
         topDigits.setPreferredSize(new Dimension(200,60));
         //Initialize the middle 2 digits' JPanel and set its preferred size
         JPanel midDigits = new JPanel();
         midDigits.setPreferredSize(new Dimension(200,60));
         //Initialize the bottom digits' JPanel and set its preferred size
         JPanel botDigits = new JPanel();
         botDigits.setPreferredSize(new Dimension(200, 75));
         //Initialize the JButton array
         digits = new JButton[11];
         //Initialize each of the top Panel's digit buttons, and add it to the top panel
         for(int i=1; i<4; i++)
              String lab=(new Integer(i)).toString();
              digits=new JButton(lab);
              topDigits.add(digits[i]);
              //Adding the top Digit Panel to the overall digit panel
              digPanel.add(topDigits, BorderLayout.CENTER);
              //Adding the middle Digit Panel to the overall digit panel
              digPanel.add(midDigits, BorderLayout.CENTER);
              //Adding the bottom Digit Panel to the overall digit panel
              digPanel.add(botDigits, BorderLayout.CENTER);
              //Add the overall digit Panel to the Frame's contentpane
              contentPane.add(digPanel, BorderLayout.CENTER);
              //Method created to add the DigitAction Listeners
              addDigitActionListeners();
    //Method created to add all of the DigitActionListeners
    private void addDigitActionListeners()
              for(int i=0; i<10; i++)
                   digits[i].addActionListener(new DigitActionListener(i));
              digits[10].addActionListener(new DigitActionListener("."));
    //DigitActionListener class
    public class DigitActionListener implements ActionListener
         private String myNum;
         public DigitActionListener(int num)
              myNum=""+num;
         public DigitActionListener(String num)
              myNum=num;
         public void actionPerformed(ActionEvent e)
              if(display.getText().equals("Please enter a valid number")|| clearScreen)
                   clearScreen=false;
                   display.setText("");
    //OperatorActionListener class
    public void OpActionListener implements ActionListener
         private int myOpNum;
         public OpActionListener(int op)
              myOpNum=op;
         public void actionPerformed(ActionEvent e)
         {  //Checks to see if the user has already enterd a number
              if(!firstFilled)
              try{
                   //Parse the number entered
                   String number=display.getText();
                   dNum1=Double.parseDouble(number);
                   //Sets the flag for the firstFilled to true
                   firstFilled=true
                   //Sets the op variable so when the "Enter" button is pressed, it will know which operation to perform
                   op=myOpNum;
                   //Clears the textbox
                   display.setText("");
                   catch(Exception er)
                        display.setText("Please enter a valid number");
         //This is the second number being entered
              else{
                   try{
                        String number=display.getText();
                        String result;
                        dNum2=Double.parseDouble(number);
                        firstFilled=true;
                        op=myOpNum;
                        display.setText("");
                   catch(Exception er)
                        display.setText("Please enter a valid number");
    private void addOperation()
         JPanel opPanel=new JPanel();
         opPanel.setPreferredSize(new Dimension(75,200));
         JButton clear = new JButton("C");
         JButton addition = new JButton("+");
         JButton subtraction = new JButton("-");
         JButton multiply = new JButton("*");
         JButton divide = new JButton("/");
         JButton mod = new JButton("%");
         JButton enter = new JButton("Enter");
         addition.addActionListener(new OpActionListener(ADD));
         subtraction.addActionListener(new OpActionListener(SUB));
         multiply.addActionListener(new OpActionListener(MUL));
         divide.addActionListener(new OpActionListener(DIV));
         mod.addActionListener(new OpActionListener(MOD));
         clear.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent e)
                   display.setText("");
                   firstFilled=false;
         enter.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent e)
                   double result;
                   String answer="";
                   String number = display.getText();
                   dNum2 = Double.parseDouble(number);
                   dNum1=Double.parseDouble(number);
                   switch(op)
                        case ADD:
                             result = dNum1 + dNum2;
                             break;
                        case SUB:
                             result = dNum1 - dNum2;
                             break;
                        case MUL:
                             result = dNum1 * dNum2;
                             break;
                        case DIV:
                             result = dNum1 / dNum2;
                             break;
                        default:
                             result= -1.0;
                             break;
                        if(result==(int)result)
                             answer=(new Integer((int)result)).toString();
                        else
                             answer=(new Double(result)).toString();
                        display.setText(answer);
                        clearScreen=true;
                        firstFilled=false;
                        dNum1=0;
                        dNum2=0;
              opPanel.add(clear);
              opPanel.add(addition);
              opPanel.add(subtraction);
              opPanel.add(multiply);
              opPanel.add(divide);
              opPanel.add(mod);
              opPanel.add(enter);
              contentPane.add(opPanel, "East");
         //Creating the frame object
         public class CalculatorMain
              public void main(String[] args)
                   CalculatorFrame cf=new CalculatorFrame();
                   cf.show();
    ERRORS THAT I HAVE!!:
    javac calculatorframe.javacalculatorframe.java:150: '(' expected
    public void OpActionListener implements ActionListener
    ^
    calculatorframe.java:7: class CalculatorFrame is public, should be declared in a file named CalculatorFrame.java
    public class CalculatorFrame extends JFrame
    ^
    calculatorframe.java:54: cannot resolve symbol
    symbol : method addOperation ()
    location: class CalculatorFrame
    addOperation();
    ^
    3 errors
    >

    Hi, actually it's all written there:
    >
    ERRORS THAT I HAVE!!:
    javac calculatorframe.javacalculatorframe.java:150: '(' expected
    public void OpActionListener implements
    ActionListenerpublic void ... is part of a possible method signature. That's probably why the compiler expects '(' as this is need for a method.
    To define a class use:
    public class ... (or better: private class ..., if the class is not used outside of this file.
    ^
    calculatorframe.java:7: class CalculatorFrame is
    public, should be declared in a file named
    CalculatorFrame.java
    public class CalculatorFrame extends JFrame
    ^As it says, you defined a class CalculatorFrame in a file calculatorframe.java. But the file name should be the same as the class name (case sensitive). Java classes should start with capital letters, so rename the file to:
    CalculatorFrame.java
    calculatorframe.java:54: cannot resolve symbol
    symbol : method addOperation ()
    location: class CalculatorFrame
    addOperation();
    ^
    3 errors
    >You didn't declare the method 'addOperation' (-> cannot resolve symbol; which simbol: method addOperation (); where: location: class CalculatorFrame; you see it's all there)
    Note there is a method called 'addOperation' in the class OpActionListener, but not in CalculatorFrame.
    Note I didn't read the code, just the error messages. I hope this helps.
    -Puce

  • Please help me, component binding not work

    Hi
    I have a HtmlSelectManyPicklist in backend and I want to bind it in my xhtml.
    when I set value from server at first time, it works fine but when I click on button to submit the form an exception is thrown with following message:
    exception when I press submit button:
    ERROR Servlet.service() for servlet Faces Servlet threw exception
    javax.faces.el.PropertyNotFoundException: /pages/main/selectColumn.xhtml @26,18 binding="#{userSetting.picklist}": Target Unreachable, identifier 'userSetting' resolved to null
            at com.sun.facelets.el.LegacyValueBinding.isReadOnly(LegacyValueBinding.java:84)
            at org.apache.myfaces.shared_impl.util.RestoreStateUtils.recursivelyHandleComponentReferencesAndSetValid(RestoreStateUtils.java:68)
            at org.apache.myfaces.shared_impl.util.RestoreStateUtils.recursivelyHandleComponentReferencesAndSetValid(RestoreStateUtils.java:41)
            at org.apache.myfaces.shared_impl.util.RestoreStateUtils.recursivelyHandleComponentReferencesAndSetValid(RestoreStateUtils.java:78)
            at org.apache.myfaces.shared_impl.util.RestoreStateUtils.recursivelyHandleComponentReferencesAndSetValid(RestoreStateUtils.java:41)
            at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:179)
            at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:29)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.seam.servlet.SeamCharacterEncodingFilter.doFilter(SeamCharacterEncodingFilter.java:41)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
            at java.lang.Thread.run(Thread.java:595)the code in server side to create a new instance of component is:
              Application app = FacesContext.getCurrentInstance().getApplication();
              picklist = (HtmlSelectManyPicklist)  app.createComponent(HtmlSelectManyPicklist.COMPONENT_TYPE);
              picklist.setValueBinding("picklist", app.createValueBinding("#{userSetting}"));the code in my xhtml file :
            <s:selectManyPicklist size="5" binding="#{userSetting.picklist}"
                                        >
                 <s:selectItems value="#{userSetting.columnHeaders}" var="column"
                                       itemValue="#{column.name}" itemLabel="#{column.label}" />
            </s:selectManyPicklist>
            <h:commandButton value="Submit" class="button" action="#{userSetting.display}"/>lots of thanks

    the code in server side to create a new instance of
    component is:
    Application app =
    =
    FacesContext.getCurrentInstance().getApplication();
    picklist = (HtmlSelectManyPicklist)
    t)
      app.createComponent(HtmlSelectManyPicklist.COMPONENT_
    YPE);
    picklist.setValueBinding("picklist",
    ", app.createValueBinding("#{userSetting}"));
    the code in my xhtml file :
    <s:selectManyPicklist size="5"
      binding="#{userSetting.picklist}"
    :selectItems value="#{userSetting.columnHeaders}"
    var="column"
    itemValue="#{column.name}"
    lumn.name}" itemLabel="#{column.label}" />
             </s:selectManyPicklist>
    <h:commandButton value="Submit"
      class="button" action="#{userSetting.display}"/>
    I haven't used selectManyPicklist . But , are you sure you want to bind it to the Component ? Can't you just bind the value attribute to some Backing Bean data type something like a String array?
    1)
    You can try the server side code that you have put in the BackingBean's constructor. or
    2) Have a instance variable of type HtmlSelectManyPicklist with getter and setter in your Backing Bean and bind it as follows.
    HtmlSelectManyPicklist  picklist;
    public getPicklist  (){
    return picklist;
    <s:selectManyPicklist size="5"
      binding="#{BackingBean.picklist}"Hope this solves your problem.
    Karthik

  • Using my new GUI component in an applet :Help!!!

    I am seeking help for the following
    Define class MyColorChooser as a new component so it can be reused in other applications or applets. We want to use the new GUI component as part of an applet that displays the current Color value.
    The following is the code of MyColorChooser class
    * a) We define a class called MyColorChooser that provides three JSlider
    * objects and three JTextField objects. Each JSlider represents the values
    * from 0 to 255 for the red, green and blue parts of a color.
    * We use wred, green and blue values as the arguments to the Color contructeur
    * to create a new Color object.
    * We display the current value of each JSlider in the corresponding JTextField.
    * When the user changes the value of the JSlider, the JTextField(s) should be changed
    * accordingly as weel as the current color.
    * b)Define class MyColorChooser so it can be reused in other applications or applets.
    * Use your new GUI component as part of an applet that displays the current
    * Color value.
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    public class MyChooserColor extends JFrame{
         private int red, green, blue;  // color shade for red, green and blue
         private static Color myColor;  // color resultant from red, green and blue shades
         private JSlider mySlider [];      
         private JTextField textField [];
    // Panels for sliders, textfields and button components
         private JPanel mySliderPanel, textFieldPanel, buttonPanel;
    // sublcass objet of JPanel for drawing purposes
         private CustomPanel myPanel;
         private JButton okButton, exitButton;
         public MyChooserColor ()     
              super( "HOME MADE COLOR COMPONENT; composition of RGB values " );
    //       setting properties of the mySlider array and registering the events
              mySlider = new JSlider [3];
              ChangeHandler handler = new ChangeHandler();
              for (int i = 0; i < mySlider.length; i++)
              {     mySlider[i] = new JSlider( SwingConstants.HORIZONTAL,
                               0, 255, 255 );
                   mySlider.setMajorTickSpacing( 10 );
                   mySlider[i].setPaintTicks( true );
    //      register events for mySlider[i]
                   mySlider[i].addChangeListener( handler);                     
    //      setting properties of the textField array           
              textField = new JTextField [3];          
              for (int i = 0; i < textField.length; i++)
              {     textField[i] = new JTextField("100.00%", 5 );
                   textField[i].setEditable(false);
                   textField[i].setBackground(Color.white);
    // initial Background color of each slider and foreground for each textfield
    // accordingly to its current color shade
              mySlider[0].setBackground(
                        new Color ( mySlider[0].getValue(), 0, 0 ) );
              textField[0].setForeground(
                        new Color ( mySlider[0].getValue(), 0, 0 ) );           
              mySlider[1].setBackground(
                        new Color ( 0, mySlider[1].getValue(), 0 ) );
              textField[1].setForeground(
                        new Color ( 0, mySlider[1].getValue(), 0 ) );
              mySlider[2].setBackground(
                        new Color ( 0, 0, mySlider[2].getValue() ) );
              textField[2].setForeground(
                        new Color ( 0, 0, mySlider[2].getValue() ) );
    // initialize myColor to white
              myColor = Color.WHITE;
    // instanciate myPanel for drawing purposes          
              myPanel = new CustomPanel();
              myPanel.setBackground(myColor);
    // instanciate okButton with its inanymous class
    // to handle its related events
              okButton = new JButton ("OK");
              okButton.setToolTipText("To confirm the current color");
              okButton.setMnemonic('o');
              okButton.addActionListener(
                   new ActionListener(){
                        public void actionPerformed (ActionEvent e)
                        {     // code permetting to transfer
                             // the current color to the parent
                             // component backgroung color
                             //System.exit( 0 );     
    //      instanciate exitButton with its inanymous class
    //      to handle its related events           
              exitButton = new JButton("Exit");
              exitButton.setToolTipText("Exit the application");
              exitButton.setMnemonic('x');
              exitButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed (ActionEvent e)
                             {     System.exit( 0 );     
    // define the contentPane
              Container c = getContentPane();
              c.setLayout( new BorderLayout() );
    //     panel as container for sliders
              mySliderPanel = new JPanel(new BorderLayout());
    //      panel as container for textFields           
              textFieldPanel = new JPanel(new FlowLayout());
    //      panel as container for Jbuttons components           
              buttonPanel = new JPanel ();
              buttonPanel.setLayout( new BoxLayout( buttonPanel, BoxLayout.Y_AXIS ) );
    //add the Jbutton components to buttonPanel           
              buttonPanel.add(okButton);
              buttonPanel.add(exitButton);
    //     add the mySlider components to mySliderPanel
              mySliderPanel.add(mySlider[0], BorderLayout.NORTH);
              mySliderPanel.add(mySlider[1], BorderLayout.CENTER);
              mySliderPanel.add(mySlider[2], BorderLayout.SOUTH);
    //add the textField components to textFieldPanel     
              for (int i = 0; i < textField.length; i++){
                   textFieldPanel.add(textField[i]);
    // add the panels to the container c          
              c.add( mySliderPanel, BorderLayout.NORTH );
              c.add( buttonPanel, BorderLayout.WEST);
              c.add( textFieldPanel, BorderLayout.SOUTH);
              c.add( myPanel, BorderLayout.CENTER );
              setSize(500, 300);          
              show();               
    //     inner class for mySlider events handling
         private class ChangeHandler implements ChangeListener {          
              public void stateChanged( ChangeEvent e )
    // start by collecting the current color shade
    // for red , forgreen and for blue               
                   setRedColor(mySlider[0].getValue());
                   setGreenColor(mySlider[1].getValue());
                   setBlueColor(mySlider[2].getValue());
    //The textcolor in myPanel (subclass of JPanel for drawing purposes)
                   myPanel.setMyTextColor( ( 255 - getRedColor() ),
                             ( 255 - getGreenColor() ), ( 255 - getBlueColor() ) );
    //call to repaint() occurs here
                   myPanel.setThumbSlider1( getRedColor() );
                   myPanel.setThumbSlider2( getGreenColor() );
                   myPanel.setThumbSlider3( getBlueColor() );
    // display color value in the textFields (%)
                   DecimalFormat twoDigits = new DecimalFormat ("0.00");
                   for (int i = 0; i < textField.length; i++){
                        textField[i].setText("" + twoDigits.format(
                                  100.0* mySlider[i].getValue()/255) + " %") ;
    // seting the textcolor for each textField
    // and the background color for each slider               
                   textField[0].setForeground(
                             new Color ( getRedColor(), 0, 0 ) );
                   mySlider[0].setBackground(
                             new Color ( getRedColor(), 0, 0) );
                   textField[1].setForeground(
                             new Color ( 0, getGreenColor() , 0 ) );
                   mySlider[1].setBackground(
                             new Color ( 0, getGreenColor(), 0) );
                   textField[2].setForeground(
                             new Color ( 0, 0, getBlueColor() ) );
                   mySlider[2].setBackground(
                             new Color ( 0, 0, getBlueColor() ) );
    // color of myPanel background
                   myColor = new Color (getRedColor(),
                             getGreenColor(), getBlueColor());
                   myPanel.setBackground(myColor);               
    // set methods to set the basic color shade
         private void setRedColor (int r){
              red = ( (r >= 0 && r <= 255) ? r : 255 );
         private void setGreenColor (int g){
              green = ( (g >= 0 && g <= 255) ? g : 255 );
         private void setBlueColor (int b){
              blue = ( (b >= 0 && b <= 255) ? b : 255 );
    // get methods (return the basic color shade)
         private int getRedColor (){
              return red ;
         private int getGreenColor (){
              return green;
         private int getBlueColor (){
              return blue;
         public static Color getMyColor (){
              return myColor;
    // main method                
         public static void main (String args []){
              MyChooserColor app = new MyChooserColor();
              app.addWindowListener(
                        new WindowAdapter() {
                             public void windowClosing( WindowEvent e )
                             {     System.exit( 0 );
    // inner class CustomPanel for drawing purposes
         private class CustomPanel extends JPanel {
              private int thumbSlider1 = 255;
              private int thumbSlider2 = 255;
              private int thumbSlider3 = 255;
              private Color myTextColor;
              public void paintComponent( Graphics g )
                   super.paintComponent( g );
                   g.setColor(myTextColor);
                   g.setFont( new Font( "Serif", Font.TRUETYPE_FONT, 12 ) );
                   DecimalFormat twoDigits = new DecimalFormat ("0.00");
                   g.drawString( "The RGB values of the current color are : "
                             + "( "     + thumbSlider1 + " , " + thumbSlider2 + " , "
                             + thumbSlider3 + " )", 10, 40);
                   g.drawString( "The current background color is composed by " +
                             "the folllowing RGB colors " , 10, 60);
                   g.drawString( "Percentage of RED from slider1 : "
                        + twoDigits.format(thumbSlider1*100.0/255), 10, 80 );
                   g.drawString( "Percentage of GREEN from slider2 : "
                        + twoDigits.format(thumbSlider2*100.0/255), 10, 100 );
                   g.drawString( "Percentage of BLUE from slider3 : "
                        + twoDigits.format(thumbSlider3*100.0/255), 10, 120 );
    // call to repaint occurs here     
              public void setThumbSlider1(int th){
                   thumbSlider1 = (th >= 0 ? th: 255 );
                   repaint();
              public void setThumbSlider2(int th){
                   thumbSlider2 = (th >= 0 ? th: 255 );
                   repaint();
              public void setThumbSlider3(int th){
                   thumbSlider3 = (th >= 0 ? th: 255 );
                   repaint();
              public void setMyTextColor(int r, int g, int b){
                   myTextColor = new Color(r, g, b);
                   repaint();
    //The following method is used by layout managers
              public Dimension getPreferredSize()
              {     return new Dimension( 150, 100 );
    The following is the code of application that tests the component
    //Application used to demonstrating
    // the homemade GUI MyChooserColor component
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class ShowMyColor extends JFrame {
         private JButton changeColor;
         private Color color = Color.lightGray;
         private Container c;
         MyChooserColor colorComponent;
         public ShowMyColor()
         {     super( "Using MyChooserColor" );
              c = getContentPane();
              c.setLayout( new FlowLayout() );
              changeColor = new JButton( "Change Color" );
              changeColor.addActionListener(
                        new ActionListener() {
                             public void actionPerformed( ActionEvent e )
                             {     colorComponent = new MyChooserColor ();
                                  colorComponent.show();
                                  color = MyChooserColor.getMyColor();
                                  if ( color == null )
                                       color = Color.lightGray;
                                  c.setBackground( color );
                                  c.repaint();
              c.add( changeColor );
              setSize( 400, 130 );
              show();
         public static void main( String args[] )
         {     ShowMyColor app = new ShowMyColor();
              app.addWindowListener(
                        new WindowAdapter() {
                             public void windowClosing( WindowEvent e )
                             {  System.exit( 0 );

    Yes, I want help for the missing code to add in actionPerformed method below. As a result, when you confirm the selected color (clicking the OK button), it will be transferred to a variable color of class ShowMyColor.
    // instanciate okButton with its inanymous class
    // to handle its related events
              okButton = new JButton ("OK");
              okButton.setToolTipText("To confirm the current color");
              okButton.setMnemonic('o');
              okButton.addActionListener(
                   new ActionListener(){
                        public void actionPerformed (ActionEvent e)
                        {     // code permetting to transfer
                             // the current color to the parent
                             // component backgroung color
                             //System.exit( 0 );     
              );

  • Urgent !please help!! how to get children component in encodeBegin()?

    hello all
    how can get children component in encodeBegin()?because when encodebegin the tree is not constituted so i can't get children component,how to solve?
    please help!

    You aren't providing enough information to know for sure what is going on, but a likely problem is that you're rendering a JSP page with a new component tree for the first time, so the components are getting built as the page executes.
    In the EA3 release, this caused a problem, because encodeBegin() was called from the doStartTag() method of the JSP tag (i.e. before the child components have been created). However, in EA4 the call to encodeBegin() was moved to doEndTag(), so the child components should now be getting created already.
    In order to debug this any further, we'll need a specific example of what you're doing, and what version of JavaServer Faces you're trying it with.
    Craig

  • Unable to determine the value of component  ''! Workflow error, please help

    Hi All:
        I am getting the error "Unable to determine the value of component  ''" and workflows are not getting processed. I found OSS notes 879100 related to this issue but I am new to workflow and not sure where to start from! Here is the notes description:
    The workflow WS20500025 ('Service Connection Order Processing') encounters an error directly after being started. The following error messages are displayed in the workflow log:
    SWP102: Error at start of an IF branch
    WL821: Work item 000000100012: Object FLOWITEM method EXECUTE cannot be executed
    SWF_RUN535: Error '9' when calling service 'SO_OBJECT_SEND'
    SWF_RUN534: Problems occurred when generating a mail
    WL863: Notification of completion cannot be generated
    SWF_EXP_001073: Unable to determine the value of component 'QUOTATION'
    SWF_EXP_001072: Error in the evaluation of expression '<???>' for item 1
    SWF_RLS_001101: Operator 'GT': The value of the left operand cannot be determined
    SWP085: Error when starting work item 000000100012
    SWP010: Error when evaluating the IF condition for node 0000000075
    Other terms
    Service connection processing, service connection workflow
    Reason and Prerequisites
    This is due to a program error.
    The checks in the workflow Basis have been made stricter. A query of the type 'Quotation.number > 0' now causes an error if the container element 'Quotation' is not set. This is always the case if the workflow is is running without quotation prcessing, for instance.
    Solution
    The error is corrected in the next Support Package.
    If you want to implement the corrections manually in your system, change the condition in step 000075 of workflow WS20500025 as follows:
        &IS-U: Kundenangebot& EX
    and &IS-U: Kundenangebot.Verkaufsbeleg& > 0
    Save and activate the workflow.
    I am new to workflow and not sure where to start from! Could someone please help me with this? Rewards assured.
    Thanks.
    Mithun

    ANy ideas? Please help me if anyone knows the answer.
    Thanks.
    Mithun

  • Please help with a DropdownIndex Component.

    Hello all,
    I have a DropdownIndex component on my table. The user can click on it and choose some an account number from a drop down list. But if there is no number, how can he add a new account number?
    The component set to readOnly - false. But I still can't input some text, like I do with the InputField.
    Please help me with a solution.
    Alex

    > Alex,
    >
    > What is your context structure? If you are using drop
    > down by index you need separate node with values
    > under your data node and this node must be
    > singelton=false. And you need to add elements to each
    > drop down values node for every element in datasource
    > node. So, if the set of values for all table rows is
    > the same it is better to use drop down by key.
    Hello Maksim,
    thanks for your advice.
    You are right. It is not a good approach to add elements to each drop down.
    I have already tried DropDownByKey. My question is:
    Is it possible to remove a key from the table, so, that the user choose only from the values. Because I don't have keys for my field. In the table field keys are shown, is it possible to show only values instead of it? Can I change the look of the DropDownByKey-Table?
    So my scenario:
    A user see value in the table, click and expand DropDown, where is the table, without keys. The user can choose the value he wants and it will be shown the table.
    Please help.

  • Please help with the GUI quiz question!

    Hi Folks,
    Please help me with the code for the following GUI.
    The display window of the application should have two panels at the top level (you could have multiple panels contained within a top-level panel). The first top level panel should have a grid or a border layout and should include apart from various label objects: 1) a textfield to store the info entered, 2) a combobox 3) a combobox or a list box , 4) a radio-button group , 5) a combo box 6) checkboxes for additional accessories, and 7) checkboxes .
    The second top-level panel that is placed at the bottom of the window should have a submit button, a clear button and a textarea for output.
    Thanks a lot.

    Please be a little more explicit about what you're doing, what you expect to happen, and what you actually observe.
    Please post a short, concise, executable example of what you're trying to do. This does not have to be the actual code you are using. Write a small example that demonstrates your intent, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.
    Post your code between [code] and [/code] tags. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.
    Please assume that we only have the core API. We have no idea what SomeCustomClass is, and neither does our collective compiler.
    If you have an error message, post the exact, complete error along with a full stack trace, if possible. Make sure you're not swallowing any Exceptions.
    Help us help you solve your problem.

  • After a licensing failure message, I tried to reinstall CS3 design standard but the error "Component Install Failed" occurred and I still am unable to use Photoshop or InDesign  Please Help!

    after a licensing failure message, I tried to reinstall CS3 design standard but the error "Component Install Failed" occurred and I still am unable to use Photoshop or InDesign  Please Help!

    J3liu1 I would recommend reviewing the installation log files for the specific error message which you are facing.  You can find details on how to locate an interpret your installation log files at Troubleshoot installation with install logs | CS3, CS4.  You are welcome to post any specific errors you discover to this discussion.

  • Please Help with Viewstack and custom component

    I'm having trouble trying to embed a component within a
    viewstack. I have my main applicaiton main.mxml application and the
    calander control from quietly scheming (app.mxml) is the component.
    The issue I'm having is how to have the calendar show within my
    viewstack canvas. The app.mxml file namespaces below:
    <?xml version="1.0" encoding="utf-8"?>
    <local:app_code xmlns:local="*" xmlns="
    http://www.adobe.com/2006/mxml"
    xmlns:qs="qs.controls.*" xmlns:g="qs.graphics.*"
    xmlns:qc="qs.containers.*"
    creationComplete="load();" xmlns:ns1="qs.containers.*"
    xmlns:effects="qs.effects.*" width="100%" height="100%"
    layout="absolute">
    <Style source="calendar.css" />
    <Style source="styles.css" />
    <Script source="app_imports.as" />
    </local>
    My application main.mxml has different namespaces:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="
    http://www.adobe.com/2006/mxml"
    initialize="showLogin();"
    layout="absolute"
    horizontalGap="0"
    horizontalAlign="center"
    cornerRadius="20"
    xmlns:controls="com.adobe.ac.controls.*"
    >
    </application>
    If I take the code out of app.mxml and plae it on my
    viewstack canvas, I get all types of errors referencing functions
    or components in the other namespaces.
    Does this make any sense ? I just want to view the calendar
    in the viewstack.
    Please help

    I guess I'm just not understanding the difference betweeen
    the <local:app_code> in the app.mxml file and the
    <mx:Application> in my main application.
    If I run the app.mxml by itself, everything is fine. if I try
    to take the code out and past it within the viewstack canvas I get
    reference errors. It can't find the objects/functions from the
    <local:app_code> namespace.
    I guess I'm just confused on how to structure the entire
    application.
    Thanks all for your responses.

  • I cannot see the Vidoe displayed on the screen, only hear the sound.  I am missing a component? Compressor, etc. I just downloaded the latest version of Quicktime for Microsoft, please help.

    I am not able to view my video taken with a memory card only the sound?  I am missing a component? Compressor, etc. I just downloaded the latest version of Quicktime for Microsoft, please help
    I can see it on Windows Media? Need help on this.

    It says SEDG 720X480 2:1 Mono.  Video came from Sd memory card taken with a Samsung Video Camera.
    Strangely enough, as a FourCC, SEDG is defined as "MPEG-4 hardware and software codec used in Samsung digital video products." Not a Windows or Samsung camcorder user but THIS WEB PAGE may be of some assistance.
    Also I will need to view a CD recorded by the same camera (DVD-RW) file extensions are VIDEO_RM.BUP
    VIDEO_TS.IFO, VIDEO_TS.VOB,  SAMSUNG.IFO  So far these files don't open even with Windows Media.
    I don't know what to do to be able to open up these files save them on my Hard drive and then be able to upload them to YouTube.  Any Ideas?
    IFO files tell how the video content is segmented and where the video data is located. BUP files contain back-up IFO information. VOB files contain actual multipled audio/video data. A DVD formatted to play in a commercial DVD player normally contains a series of files named "VTS##_#.VOB" where ## refers to the "title" series and "_#" (where # is not a zero) refers to the order in which the video title file data is played.
    Again, I am neither a Windows user nor an athority on Samsung VIDEO_RM folder structures. However, if your disc contains both a VIDEO_RM and VIDEO_TS folder, then I would normally assume the VIDEO_RM folder is present for legacy purposes and/or to provide information about the refording device while the VIDEO_TS folder actually contains the video object (VOB) file data. In any case, as I am not familiar with what software is available for muxed MPEG-2/AC3 editing/conversion on a Windows platform, I would try viewing the VOB files in an application like MPEG Streamclip (free). If you can play the Audio and video content (be sure to read the MPEG Streamclip requirements regarding codec installation), then you can edit (merge and/or trim) the raw data and convert it to a format compatible for YouTube uploading. (I.e., MPEG Streamclip is commonly used on the Mac for this type of work flow and the app is also available for Windows use.)

  • Please help: password protected GUI

    hi
    can any one help me GUI of application to be password protected. in the attachment graph whould be visible all the time but when i enter 1 password filtered signal and its corresponding parameters are visible (now graph and filtered signal waveform and its parameter are visible) and when i enter 2nd password all things must be visible.
    please help
    Attachments:
    1.vi ‏80 KB

    smercurio_fc, see now you are following me around.... (Beat you by a few minutes on the other tread).
    I think the question is not about passwording the diagram, but a UI choice where certain parts are only shown after entering a password. For example, there might be data for the operator and there might be extra data or controls only of interest to the engineer. The display should change depending on the  privileges of the current user.
    Message Edited by altenbach on 05-17-2007 01:33 PM
    LabVIEW Champion . Do more with less code and in less time .

  • Please Help - Need Help with Buttons for GUI for assignment. URGENT!!

    Can someone please help me with the buttons on this program? I cannot figure out how to get them to work.
    Thanks!!!
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    import javax.swing.JButton;
    public class InventoryTAH implements ActionListener
        Maker[] proMaker;
        JTextField[] fields;
        NumberFormat nf;
        public void actionPerformed(ActionEvent e)
            int index = ((JComboBox)e.getSource()).getSelectedIndex();
            populateFields(index);
        public static void main(String[] args)
            try
                UIManager.setLookAndFeel(
                        "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            catch (Exception e)
                System.err.println(e.getClass().getName() + ": " + e.getMessage());
            InventoryTAH test = new InventoryTAH();
            test.initMakers();
            test.showGUI();
            test.populateFields(0);
        private void initMakers() {
            proMaker = new Maker[10];
            proMaker[0] = new Maker( 1, "Pens",1.59,100,"Bic");
            proMaker[1] = new Maker( 2, "Pencils", .65, 100,"Mead");
            proMaker[2] = new Maker( 3, "Markers", 1.29, 100,"Sharpie");
            proMaker[3] = new Maker( 4, "Paperclips", 1.19, 100,"Staples");
            proMaker[4] = new Maker( 5, "Glue", .85, 100,"Elmer's");
            proMaker[5] = new Maker( 6, "Tape", .50, 100,"3m");
            proMaker[6] = new Maker( 7, "Paper", 1.85, 100,"Mead");
            proMaker[7] = new Maker( 8, "Stapler", 2.21, 100,"Swingline");
            proMaker[8] = new Maker( 9, "Folders", .50, 100,"Mead");
            proMaker[9] = new Maker( 10, "Rulers", .27, 100,"Stanley");      
          int maxNum = 10;
          int currentNum = 0;
          int currentInv = 0;
             Action firstAction = new AbstractAction("First")
              public void actionPerformed(ActionEvent evt)
                   currentInv = 0;
                   int populateFields;
          JButton firstButton = new JButton(firstAction);
          Action previousAction = new AbstractAction("Previous")
              public void actionPerformed(ActionEvent evt)
                   currentInv--;
                   if (currentInv < 0)
                        currentInv = maxNum - 1;
                   int populateFields;
          JButton previousButton = new JButton(previousAction);
          Action nextAction  = new AbstractAction("Next")
              public void actionPerformed(ActionEvent evt)
                   currentInv++;
                   if (currentInv >= currentNum)
                        currentInv = 0;
                  int populateFields;
          JButton nextButton = new JButton(nextAction);
          Action lastAction = new AbstractAction("Last")
              public void actionPerformed(ActionEvent evt)
                   currentInv = currentNum - 1;
                   int populateFields;
          JButton lastButton = new JButton(lastAction);
              JPanel buttonPanel = new JPanel( );
        private void showGUI() {
            JLabel l;
            JButton button1;
                JButton button2;
            fields = new JTextField[8];
            JFrame f = new JFrame("Inventory");
            Container cp = f.getContentPane();
            cp.setLayout(new GridBagLayout());
            cp.setBackground(UIManager.getColor(Color.BLACK));
            GridBagConstraints c = new GridBagConstraints();
            c.gridx = 0;
            c.gridy = GridBagConstraints.RELATIVE;
            c.gridwidth = 1;
            c.gridheight = 1;
            c.insets = new Insets(2, 2, 2, 2);
            c.anchor = GridBagConstraints.EAST;
            cp.add(l = new JLabel("Item Number:", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('a');
            cp.add(l = new JLabel("Item Name:", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('b');
            cp.add(l = new JLabel("Number of Units in Stock:", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('c');
            cp.add(l = new JLabel("Price per Unit: $", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('d');
            cp.add(l = new JLabel("Total cost of Item: $", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('e');
            cp.add(l = new JLabel("Total Value of Merchandise in Inventory: $", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('f');
            cp.add(l = new JLabel("Manufacturer:", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('g');
            cp.add(l = new JLabel("Restocking Fee: $", SwingConstants.CENTER), c);
            l.setDisplayedMnemonic('h');
                c.gridx = 1;
            c.gridy = 0;
            c.weightx = 1.0;
            c.fill = GridBagConstraints.HORIZONTAL;
            c.anchor = GridBagConstraints.CENTER;
            cp.add(fields[0] = new JTextField(), c);
            fields[0].setFocusAccelerator('a');
            c.gridx = 1;
            c.gridy = GridBagConstraints.RELATIVE;
            cp.add(fields[1] = new JTextField(), c);
            fields[1].setFocusAccelerator('b');
            cp.add(fields[2] = new JTextField(), c);
            fields[2].setFocusAccelerator('c');
            cp.add(fields[3] = new JTextField(), c);
            fields[3].setFocusAccelerator('d');
            cp.add(fields[4] = new JTextField(), c);
            fields[4].setFocusAccelerator('e');
            cp.add(fields[5] = new JTextField(), c);
            fields[5].setFocusAccelerator('f');
            cp.add(fields[6] = new JTextField(), c);
            fields[6].setFocusAccelerator('g');
            cp.add(fields[7] = new JTextField(), c);
            fields[7].setFocusAccelerator('h');
            c.weightx = 0.0;
            c.fill = GridBagConstraints.NONE;
              cp.add(firstButton);
              cp.add(previousButton);
              cp.add(nextButton);
              cp.add(lastButton);
                          JComboBox combo = new JComboBox();
            for(int j = 0; j < proMaker.length; j++)
                combo.addItem(proMaker[j].getName());
            combo.addActionListener(this);
                cp.add(combo);
                cp.add(button1 = new JButton("   "), c);
            f.pack();
            f.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent evt)
                    System.exit(0);
            f.setVisible(true);
      private void populateFields(int index) {
            Maker maker = proMaker[index];
            fields[0].setText(Long.toString(maker.getNumberCode()));
            fields[1].setText(maker.getName());
            fields[2].setText(Long.toString(maker.getUnits()));
            fields[3].setText(Double.toString(maker.getPrice()));
            fields[4].setText(Double.toString(maker.getSum()));
            fields[5].setText(Double.toString(maker.totalAllInventory(proMaker)));
            fields[6].setText(maker.getManufact());
            fields[7].setText(Double.toString(maker.getSum()*.05));       
    class Maker {
        int itemNumber;
        String name;
        int units;
        double price;
        String manufacturer;
        public Maker(int n, String name, double price, int units, String manufac) {
            itemNumber = n;
            this.name = name;
            this.price = price;
            this.units = units;
            manufacturer = manufac;
        public int getNumberCode() { return itemNumber; }
        public String getName() { return name; }
        public int getUnits() { return units; }
        public double getPrice() { return price; }
        public double getSum() { return units*price; }
        public String getManufact() { return manufacturer; }
        public double totalAllInventory(Maker[] makers) {
            double total = 0;
            for(int j = 0; j < makers.length; j++)
                total += makers[j].getSum();
            return total;
    }}

    // I have made some modifications. Please try this.
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    import javax.swing.JButton;
    public class InventoryTAH implements ActionListener
    Maker[] proMaker;
    JTextField[] fields;
    NumberFormat nf;
    int currentInv = 0;
    public void actionPerformed(ActionEvent e)
    currentInv= ((JComboBox)e.getSource()).getSelectedIndex();
    populateFields(currentInv);
    public static void main(String[] args)
    try
    UIManager.setLookAndFeel(
    "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    catch (Exception e)
    System.err.println(e.getClass().getName() + ": " + e.getMessage());
    InventoryTAH test = new InventoryTAH();
    test.initMakers();
    test.showGUI();
    test.populateFields(0);
    private void initMakers() {
    proMaker = new Maker[10];
    proMaker[0] = new Maker( 1, "Pens",1.59,100,"Bic");
    proMaker[1] = new Maker( 2, "Pencils", .65, 100,"Mead");
    proMaker[2] = new Maker( 3, "Markers", 1.29, 100,"Sharpie");
    proMaker[3] = new Maker( 4, "Paperclips", 1.19, 100,"Staples");
    proMaker[4] = new Maker( 5, "Glue", .85, 100,"Elmer's");
    proMaker[5] = new Maker( 6, "Tape", .50, 100,"3m");
    proMaker[6] = new Maker( 7, "Paper", 1.85, 100,"Mead");
    proMaker[7] = new Maker( 8, "Stapler", 2.21, 100,"Swingline");
    proMaker[8] = new Maker( 9, "Folders", .50, 100,"Mead");
    proMaker[9] = new Maker( 10, "Rulers", .27, 100,"Stanley");
         int maxNum = 10;
         int currentNum = 0;
    Action firstAction = new AbstractAction("First")
              public void actionPerformed(ActionEvent evt)
                   currentInv = 0;
                   populateFields(currentInv);
         JButton firstButton = new JButton(firstAction);
         Action previousAction = new AbstractAction("Previous")
              public void actionPerformed(ActionEvent evt)
                   currentInv--;
                   if (currentInv < 0)
                        currentInv = maxNum - 1;
                   populateFields(currentInv);
         JButton previousButton = new JButton(previousAction);
         Action nextAction = new AbstractAction("Next")
              public void actionPerformed(ActionEvent evt)
                   currentInv++;
                   if (currentInv >= maxNum)
                        currentInv = 0;
              populateFields(currentInv);
         JButton nextButton = new JButton(nextAction);
         Action lastAction = new AbstractAction("Last")
              public void actionPerformed(ActionEvent evt)
                   currentInv = maxNum-1;
                   populateFields(currentInv);
         JButton lastButton = new JButton(lastAction);
              JPanel buttonPanel = new JPanel( );
    private void showGUI() {
    JLabel l;
    JButton button1;
              JButton button2;
    fields = new JTextField[8];
    JFrame f = new JFrame("Inventory");
    Container cp = f.getContentPane();
    cp.setLayout(new GridBagLayout());
    cp.setBackground(UIManager.getColor(Color.BLACK));
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = GridBagConstraints.RELATIVE;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.insets = new Insets(2, 2, 2, 2);
    c.anchor = GridBagConstraints.EAST;
    cp.add(l = new JLabel("Item Number:", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('a');
    cp.add(l = new JLabel("Item Name:", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('b');
    cp.add(l = new JLabel("Number of Units in Stock:", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('c');
    cp.add(l = new JLabel("Price per Unit: $", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('d');
    cp.add(l = new JLabel("Total cost of Item: $", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('e');
    cp.add(l = new JLabel("Total Value of Merchandise in Inventory: $", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('f');
    cp.add(l = new JLabel("Manufacturer:", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('g');
    cp.add(l = new JLabel("Restocking Fee: $", SwingConstants.CENTER), c);
    l.setDisplayedMnemonic('h');
              c.gridx = 1;
    c.gridy = 0;
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.CENTER;
    cp.add(fields[0] = new JTextField(), c);
    fields[0].setFocusAccelerator('a');
    c.gridx = 1;
    c.gridy = GridBagConstraints.RELATIVE;
    cp.add(fields[1] = new JTextField(), c);
    fields[1].setFocusAccelerator('b');
    cp.add(fields[2] = new JTextField(), c);
    fields[2].setFocusAccelerator('c');
    cp.add(fields[3] = new JTextField(), c);
    fields[3].setFocusAccelerator('d');
    cp.add(fields[4] = new JTextField(), c);
    fields[4].setFocusAccelerator('e');
    cp.add(fields[5] = new JTextField(), c);
    fields[5].setFocusAccelerator('f');
    cp.add(fields[6] = new JTextField(), c);
    fields[6].setFocusAccelerator('g');
    cp.add(fields[7] = new JTextField(), c);
    fields[7].setFocusAccelerator('h');
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
              cp.add(firstButton);
              cp.add(previousButton);
              cp.add(nextButton);
              cp.add(lastButton);
                        JComboBox combo = new JComboBox();
    for(int j = 0; j < proMaker.length; j++)
    combo.addItem(proMaker[j].getName());
    combo.addActionListener(this);
              cp.add(combo);
              cp.add(button1 = new JButton(" "), c);
    f.pack();
    f.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent evt)
    System.exit(0);
    f.setVisible(true);
    private void populateFields(int index) {
    Maker maker = proMaker[index];
    fields[0].setText(Long.toString(maker.getNumberCode()));
    fields[1].setText(maker.getName());
    fields[2].setText(Long.toString(maker.getUnits()));
    fields[3].setText(Double.toString(maker.getPrice()));
    fields[4].setText(Double.toString(maker.getSum()));
    fields[5].setText(Double.toString(maker.totalAllInventory(proMaker)));
    fields[6].setText(maker.getManufact());
    fields[7].setText(Double.toString(maker.getSum()*.05));
    class Maker {
    int itemNumber;
    String name;
    int units;
    double price;
    String manufacturer;
    public Maker(int n, String name, double price, int units, String manufac) {
    itemNumber = n;
    this.name = name;
    this.price = price;
    this.units = units;
    manufacturer = manufac;
    public int getNumberCode() { return itemNumber; }
    public String getName() { return name; }
    public int getUnits() { return units; }
    public double getPrice() { return price; }
    public double getSum() { return units*price; }
    public String getManufact() { return manufacturer; }
    public double totalAllInventory(Maker[] makers) {
    double total = 0;
    for(int j = 0; j < makers.length; j++)
    total += makers[j].getSum();
    return total;
    }}

  • The ipod could not be synced because the sync session failed to start. A required iTunes component is not installed. Please repair or reinstall iTunes. (42404) I tried uninstalling, reinstalling, and repair. This is the newest version 11.0.1  Please help!

    I do not know what to do about this please help!
    -Sync session failed to start

    Try:
    Sync Session Failed to Start iTouch iOS5: Apple Support Communities
    iphone could not be synced sync session failed to start...: Apple Support Communities

  • Easy Java GUI Question Please Help!

    Please help! whenever I try to run this code:
    package here;
    import java.awt.Graphics;
    import java.awt.Color;
    mport javax.swing.JFrame;
    public class Window extends JFrame {
    public Window(){
         setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    setSize(500,500);
         public void paint(Graphics g){
    g.drawString("Hello!", 75, 75);
    public static void main(String[] args) {
    new Window();
    this keeps happening http://www.youtube.com/watch?v=k7htCX6a4BI&feature=watch_response
    (I didn't post this video but it looks like I'm not the only one this has happened to)
    its like I get a weird screen capture :/
    I tried setting the bacgkround color and I tried using netbeans instead of eclipse. neither worked.
    Any help would be really great! I don't want to get discouraged from learning java!

    First of all it contains Syntax error .
    Call the super paint method when trying to override the paint method .
    package here;
    import java.awt.Graphics;
    import java.awt.Color;
    import javax.swing.JFrame;
    public class Window extends JFrame {
    public Window(){
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    setSize(500,500);
    public void paint(Graphics g){
    // call the base paint method first
    super.paint(g);
    g.drawString("Hello!", 75, 75);
    public static void main(String[] args) {
    new Window();
    Edited by: VID on Mar 31, 2012 5:05 AM

Maybe you are looking for

  • Display save as dialog when downloading a file

    Hi, I want to display a save as dialog when the user downloads a file. Now I get a dialog where the user can choose to open or save it. I set these headers: res.setHeader("Content-disposition", "attachment; filename=" + filnamn); res.addHeader("Conte

  • Domain value range

    hi i am changing the table field domain value range. after changing i am getting the warning msg like below. if i ignore it and transport odes it affect anyways. and also does anyone tell me when we transport only the structure get transported or eve

  • Won't load anymore so

    Hi, i have a Zen Xtra 40 gb. i have about 9 gigs left but my player wont load anymore songs. it says that there is an error and that i must restart my player. So i deleted some songs, restarted my player and was able to upload some more songs up to a

  • How to insert timestamp ?

    I have a table with column timestamp(6) .When I query the database the data is as follows select start_time from timetable; 1/11/2007 2:52:35.231000 AM 1/11/2007 2:51:21.747000 AM ...so on . I would like to insert the timestamp values into this. I ca

  • Wirless Router weak

    My Airport Exteme has not worked very smoothly since the July software update. Linksys Wireless G router (with Vonage phone). Typically, upon boot I get a message to the effect: "none of your trusted wireless networks can be found. Would you like to