Print out Forte Arrays

Greetings All:
I'd like to know if anyone has had any experience printing out
Forte Arrays[screen tables] from the Forte Window it exists in.
Example:
A Forte window exists that contains Forte Arrays. I
want an option to either select from the pulldown
FILE menu or select a button which will automatically
print out the contents of that Forte Array.
Has anyone tried to resolve this kind of problem before?
Regards,
Antonio Mercado

try this
import java.io.*;
import java.util.*;
public class PrintE {
public static void main (String [] args) {
String line = null;
String fname = null;
Vector v=new Vector();
try {
System.out.println("Enter file for Entropy print out:");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
fname = in.readLine();
catch(IOException e){
e.printStackTrace();
try{
String in= null;
FileReader fr = new FileReader(fname);
BufferedReader br = new BufferedReader(fr);
while ((in = br.readLine()) !=null) {
v.addElement(in);
System.out.println(in); }
catch(IOException e){
e.printStackTrace();
System.out.print("Enter line:");
int index = Integer.parseInt(fname);
System.out.println(.get(index -1)); //probs here
assuming user enter say 4
say
index=4;
then
System.out.println(v.elementAt(index-1));
hope this helps

Similar Messages

  • How can I print out an Array List in my GUI program?

    I have an ArrayList of Objects which I want to print out in a TextArea in my GUI. I tried using setText(), but it seems like that can only handle strings. Does anyone know of an alternative method or some other way to get around this?

    Ok, I have an object name Instrument which contains a double price, String name, int numberInStock. In my GUIFrame class which creates the GUI obviously, I have a button listener that should print out my ArrayList in a TextArea when clicked on a button.
    Here is the code:
    private class showIResponse implements ActionListener{
              public void actionPerformed(ActionEvent e){
                   showText.setText(parseString(ali));
    it is still giving me an error saying "cannot find symbol method parseString(java.util.ArrayList<java.lang.Object>)"

  • Using Reflection to check a value in an Array and then print out the array

    Hi,
    I have a int Array say,
    static final int [] myNumbers = {407,408};
    In the program if the input value is either 407 or 408, the output should be the field name myNumbers.
    I am experiencing problem with arrays. For other types ( like int ),
    I was able to successfully do it.
    Thanks in advance.

    Check the reflection category on esus:
    http://www.esus.com/docs/GetIndexPage.jsp?uid=221

  • Print out array to JTextArea

    Hello!
    I having trouble to print out the array to a JTextArea.
    This is an asignment so please do not spoonfeed me with code.
    To test that I have added elements correctly in my array I sat it up to print out in console, wich works fine.
    Please give me a hint on what I need to do in order to make it work. Below you see the code that is important for this part of the program.
    Part of my controller:
    //User press "Show Runners" button
              else if(user_action.equals("Show Runners")) {
                   //Call method in model class
                   model.showRunnersBy_startNR();
                   //Display (I will use this once I print out to JTextArea)
                   //view.setDisplayArea(""+model.showRunnersBy_startNR());
              }//End if statementPart of my model
    //showRunnersBY_startNR
         public void showRunnersBy_startNR() {
              for(int i = 0; i <store.getIndex_runner(); i++) {
                   System.out.println(store.global_runner.getRunners());     //Print out in console for now to see that the input and output is working correctly
    //I should have this as "public String showRunnersBy_startNR()" instead with a return statment, correct?
    //I tryed the above but did only manage to print out my latest input in the JTextArea
    Part of my view// Sets the text displayed on the display area
         public void setDisplayArea(String message){
              display.setText(""+message);

    Hello again!
    I see :)
    part of my model
         //showRunnersBY_startNR
         public void showRunnersBy_startNR() {
              for(int i = 0; i <store.getIndex_runner(); i++) {
                   view.setDisplayArea(store.global_runner.getRunners());     
              }part of my view     // Sets the text displayed on the display area
         public void setDisplayArea(String message){
              display.append(""+message+"\n");
         }SetText() seemed to only print out the last one added to the array, so I I used the "append" instead.
    Thanks for the hint.
    Regards
    Martin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Print out array

    The code does not print out like it shoud. What am I doing wrong? Thank you for help
    public class test {
        public static void main(String ... args) {
            String text = "array";
            char[] textArray = text.toCharArray();
            System.out.println("     text >" + text);
            System.out.print("textArray >" + textArray);
    }output:
         text >array
    textArray >[C@addbf1

    Once again this is printing out correctly, to get your desired syntax you could loop through the array e.g
    public class test {   
       public static void main(String ... args) {
             String text = "array";
             char[] textArray = text.toCharArray();
             System.out.println("text > " + text);
             System.out.print("textArray > ");
             for(int i = 0;i<textArray.length;i++){
                 System.out.print(textArray);
    }Calypso                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Array keeps printing out null

    I have an array that continues to print out null but when I trace it exactly after I store it, it stores what I want it to store. "White Bread"
    Here is where the errors at:
    int orderNum = 0;
                   while(orderNum < cartItems)
                        printItems = "<html>" + printItems + "<br>1" + itemNameStrings[orderNum] + "</html>";
                        System.out.println(printItems);//Trace
                        System.out.println(cartItems);//Trace
                        System.out.println(orderNum);//Trace
                        System.out.println(itemNameStrings[orderNum]);//Trace
                        orderNum++;
                   }And here is the whole project:
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.border.*;
    import java.text.*;
    public class AdrianP1 implements ActionListener
         //---------------GLOBAL DECLARING------------------
         DecimalFormat Currency = new DecimalFormat("#0.00 dollars");//Currency
         //Changing Variables (void)
         String printItems = "Items";
         int arraySize = 2;
         String[] itemNameStrings;
         boolean first = true;
         boolean order = false;
         String itemName = "Error";
         double itemCost = 0.00;
         int cartItems = 0;
         //Main Frames
         final JFrame frame = new JFrame("Subway Sandwich Store");
         JFrame mainFrame = new JFrame("Subway Sandwich Store | Welcome");
         JFrame menuFrame = new JFrame("Subway Sandwich Store | Main Menu");
         JFrame instrucFrame = new JFrame("Subway Sandwich Store | Instructions");
         JFrame playFrame = new JFrame("Subway Sandwich Store | Play Game");
         JFrame breadFrame = new JFrame("Subway Sandwich Store | Order Bread");
         JFrame toppingFrame = new JFrame("Subway Sandwich Store | Order Toppings");
         JFrame condimentFrame = new JFrame("Subway Sandwich Store | Order Condiments");
         JFrame confirmFrame = new JFrame("Subway Sandwich Store | Confirm Your Order");
         JFrame cartFrame = new JFrame("Subway Sandwich Store | Your Cart");
         //---Main Buttons---
         final JButton mainMenuButton = new JButton("Main Menu");
         final JButton mainMenuButton1 = new JButton("Main Menu");
         final JButton mainMenuButton2 = new JButton("Main Menu");
         final JButton mainMenuButton3 = new JButton("Main Menu");
         final JButton goBackButton = new JButton("Go back");
         final JButton goBackButton1 = new JButton("Go back");
         final JButton goBackButton2 = new JButton("Go back");
         final JButton goBackButton3 = new JButton("Go back");
         final JButton goBackButton4 = new JButton("Go back");
         final JButton playButton1 = new JButton("Order Now!");
         final JButton playButton2 = new JButton("Order Now!");
         final JButton instrucButton = new JButton("Instructions");
         final JButton exitButton = new JButton("Exit");
         //---Play Buttons---     
         final JButton checkButton = new JButton("Check Out");
         final JButton checkButton1 = new JButton("Check Out");
         final JButton cartButton = new JButton("Cart (" + cartItems + ")");
         final JButton breadButton = new JButton("Bread");
         final JButton toppingsButton = new JButton("Toppings");
         final JButton condimentsButton = new JButton("Condiments");
         //-------Bread------
         double bwCost = 0.50, bwlCost = 0.50, biCost = 0.75, bhCost = 0.50;
         boolean whiteB = false, wholeB = false, italB = false, harvestB = false;
         final JButton whiteBreadButton = new JButton("Order White");
         final JButton wholeBreadButton = new JButton("Order Wheat");
         final JButton italianBreadButton = new JButton("Order Italian");
         final JButton harvestBreadButton = new JButton("Oder Harvest");
         //-----Toppings-----
         JButton orderTopButton = new JButton("Order the Selected Topping");
         JLabel pictureTop;
         JComboBox toppingList;
         //----Condiments----
         final JButton ketchupButton = new JButton("Order Ketchup");
         final JButton mustardButton = new JButton("Order Mustard");
         final JButton relishButton = new JButton("Order Relish");
         //-----Confirm------
         final JLabel confirmTextLabel;
         final JButton acceptButton = new JButton("Accept");
         final JButton declineButton = new JButton("Decline");
         //----Cart Screen---
         final JLabel cartItemLabel = new JLabel("<html><u>Items</u><br>No Items.</html>", JLabel.LEFT);
         final JLabel cartPriceLabel = new JLabel("<html><u>Price</u><br>No Items.</html>");
         //-------------END GLOBAL DECLARING-----------------     
         //ActionPerformed Method
         public void actionPerformed(ActionEvent event)
              if(event.getSource()==mainMenuButton || event.getSource()==mainMenuButton1 || event.getSource()==mainMenuButton2 || event.getSource()==mainMenuButton3)
                   playFrame.setVisible(false);
                   mainFrame.setVisible(false);
                   instrucFrame.setVisible(false);
                   menuFrame.setVisible(true);
              if(event.getSource()==goBackButton || event.getSource()==goBackButton1 || event.getSource()==goBackButton2 || event.getSource()==goBackButton3 || event.getSource()==goBackButton4)
                   cartFrame.setVisible(false);
                   confirmFrame.setVisible(false);
                   condimentFrame.setVisible(false);
                   toppingFrame.setVisible(false);
                   breadFrame.setVisible(false);
                   instrucFrame.setVisible(false);
                   playFrame.setVisible(true);
              if(event.getSource()==instrucButton)
                   menuFrame.setVisible(false);
                   instrucFrame.setVisible(true);
              if(event.getSource()==playButton1 || event.getSource()==playButton2)
                   instrucFrame.setVisible(false);
                   menuFrame.setVisible(false);
                   playFrame.setVisible(true);
              if(event.getSource()==breadButton)
                   playFrame.setVisible(false);
                   menuFrame.setVisible(false);
                   breadFrame.setVisible(true);
              if(event.getSource()==toppingsButton)
                   playFrame.setVisible(false);
                   toppingFrame.setVisible(true);
              if(event.getSource()==condimentsButton)
                   playFrame.setVisible(false);
                   condimentFrame.setVisible(true);
              if(event.getSource()==acceptButton)
                   ++arraySize;
                   itemNameStrings = new String[arraySize];
                   itemNameStrings[cartItems] = itemName;
                   System.out.println(itemNameStrings[cartItems]);
                   cartItems++;
                   cartButton.setText("Cart (" + cartItems + ")");
                   confirmFrame.setVisible(false);
                   playFrame.setVisible(true);
              if(event.getSource()==declineButton)
                   confirmFrame.setVisible(false);
                   playFrame.setVisible(true);
              if(event.getSource()==cartButton)
                   int orderNum = 0;
                   while(orderNum < cartItems)
                        printItems = "<html>" + printItems + "<br>1" + itemNameStrings[orderNum] + "</html>";
                        System.out.println(printItems);//Trace
                        System.out.println(cartItems);//Trace
                        System.out.println(orderNum);//Trace
                        System.out.println(itemNameStrings[orderNum]);//Trace
                        orderNum++;
                   cartItemLabel.setText(printItems);
                   System.out.println(printItems);
                   playFrame.setVisible(false);
                   cartFrame.setVisible(true);
              if(order==true)
                   if(event.getSource()==whiteBreadButton)
                        whiteB = true;
                        itemName = "White Bread";
                        itemCost = bwCost;
                        confirmTextLabel.setText("<html>Would you like to purchase <u>" + itemName + "</u> <br>for a cost of <u>$" + Currency.format(itemCost) + "</u>?</html>");
                        breadFrame.setVisible(false);
                        confirmFrame.setVisible(true);
                   if(event.getSource()==wholeBreadButton)
                        wholeB = true;
                        confirmFrame.setVisible(true);
                   if(event.getSource()==italianBreadButton)
                        italB = true;
                        confirmFrame.setVisible(true);
                   if(event.getSource()==harvestBreadButton)
                        harvestB = true;
                        confirmFrame.setVisible(true);
              if(event.getSource()==exitButton)
                   System.exit(0);
              if(event.getSource()==toppingList)
                   JComboBox cb = (JComboBox)event.getSource();
                 String toppingName = (String)cb.getSelectedItem();
                 updateLabel(toppingName);
         //Main Method   
        public static void main(String[] args) throws Exception
             new AdrianP1();         
        //Constructive and Starting Method
        AdrianP1()
             //--------------------------Action Listeners----------------------------------
             //Creates all action listeners
             mainMenuButton.addActionListener(this);
             mainMenuButton1.addActionListener(this);
             mainMenuButton2.addActionListener(this);
             mainMenuButton3.addActionListener(this);
             goBackButton.addActionListener(this);
             goBackButton1.addActionListener(this);
             goBackButton2.addActionListener(this);
             goBackButton3.addActionListener(this);
             goBackButton4.addActionListener(this);
             exitButton.addActionListener(this);
              instrucButton.addActionListener(this);
              playButton1.addActionListener(this);
              playButton2.addActionListener(this);
              breadButton.addActionListener(this);
              toppingsButton.addActionListener(this);
              condimentsButton.addActionListener(this);
              //Bread buttons
              whiteBreadButton.addActionListener(this);
              //Final buttons
              cartButton.addActionListener(this);
              acceptButton.addActionListener(this);
              declineButton.addActionListener(this);
              //--------------------------Splash Screen----------------------------------
             //Declaring
             order = false;
             final ImageIcon welcomePic = new ImageIcon("welcome.jpg");
             final JPanel sMainPanel = new JPanel(new BorderLayout());
             final JPanel sTopPanel = new JPanel(new BorderLayout());  
             final JPanel sButtonPanel = new JPanel(new FlowLayout ());
             final JLabel sTextLabel = new JLabel("Please click the button below", JLabel.CENTER);     
             final JLabel label = new JLabel("Subway Sandwich Store");
             final JLabel welcomeLPic = new JLabel(welcomePic);
              sTopPanel.add(welcomeLPic , BorderLayout.NORTH);
              sTopPanel.add(sTextLabel);
              sButtonPanel.add(mainMenuButton1);
              sMainPanel.add(sTopPanel , BorderLayout.CENTER);
              sMainPanel.add(sButtonPanel , BorderLayout.SOUTH);
                 mainFrame.setContentPane(sMainPanel);
             mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             mainFrame.pack();
             mainFrame.setVisible(true);
             mainFrame.setSize(350,390);
              //--------------------------Main Menu----------------------------------
              //Declaring
              order = false;
              final ImageIcon mainMenuImage = new ImageIcon("mainMenuImage.jpg");
              final JPanel mMainPanel = new JPanel(new BorderLayout());
              final JPanel mTopPanel = new JPanel(new BorderLayout());
              final JPanel mButtonPanel = new JPanel(new FlowLayout());
              final JLabel imageLabel = new JLabel(mainMenuImage);
              final JLabel textLabel = new JLabel("Please click a button", JLabel.CENTER);
              mTopPanel.add(imageLabel , BorderLayout.NORTH);
              mTopPanel.add(textLabel , BorderLayout.CENTER);
              mButtonPanel.add(playButton1);
              mButtonPanel.add(instrucButton);
              mButtonPanel.add(exitButton);
              mMainPanel.add(mTopPanel, BorderLayout.CENTER);
              mMainPanel.add(mButtonPanel, BorderLayout.SOUTH);
                 menuFrame.setContentPane(mMainPanel);
             menuFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             menuFrame.pack();
             menuFrame.setVisible(false);
             menuFrame.setSize(350,390);
              //--------------------------Instructions----------------------------------
              //Declaring
              order = false;
              final JPanel iTopPanel = new JPanel(new BorderLayout());
              final JPanel iButtonPanel = new JPanel(new FlowLayout());
              final JPanel iMainPanel = new JPanel(new BorderLayout());
              final JLabel iTextLabel = new JLabel("Instructions go HRER!", JLabel.CENTER);
              iTopPanel.add(iTextLabel);
              iButtonPanel.add(mainMenuButton3);
              iButtonPanel.add(playButton2);
              iMainPanel.add(iTopPanel, BorderLayout.CENTER);
              iMainPanel.add(iButtonPanel, BorderLayout.SOUTH);
              iTopPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));
              instrucFrame.setContentPane(iMainPanel);
             instrucFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             instrucFrame.pack();
             instrucFrame.setVisible(false);
             instrucFrame.setSize(350,390);
              //--------------------------Play Game----------------------------------
              //Declaring
              order = false;
              final ImageIcon playImage = new ImageIcon("playGameImage.jpg");
              final JPanel pTopPanel = new JPanel(new BorderLayout());
              final JPanel pInstrucPanel = new JPanel(new FlowLayout());
              final JPanel pButtonPanel = new JPanel(new FlowLayout());
              final JPanel pButton1Panel = new JPanel(new FlowLayout());
              final JPanel pButton2Panel = new JPanel(new FlowLayout());
              final JPanel pMainPanel = new JPanel(new BorderLayout());
              final JLabel pImageLabel = new JLabel(playImage);
              final JLabel pTextLabel = new JLabel("Click below to customize your sandwich; or check out", JLabel.CENTER);
              pTopPanel.add(pButton2Panel, BorderLayout.NORTH);
              pTopPanel.add(pImageLabel, BorderLayout.CENTER);
              pInstrucPanel.add(pTextLabel, BorderLayout.SOUTH);
              pButton1Panel.add(breadButton);
              pButton1Panel.add(toppingsButton);
              pButton1Panel.add(condimentsButton);
              pButton2Panel.add(checkButton);
              pButton2Panel.add(cartButton);
              pButton2Panel.add(mainMenuButton2);
              pButtonPanel.add(pButton1Panel);
              pMainPanel.add(pTopPanel, BorderLayout.NORTH);
              pMainPanel.add(pInstrucPanel, BorderLayout.CENTER);
              pMainPanel.add(pButtonPanel, BorderLayout.SOUTH);
              pInstrucPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));
              playFrame.setContentPane(pMainPanel);
             playFrame.setDefaultCloseOperation(playFrame.EXIT_ON_CLOSE);
             playFrame.pack();
             playFrame.setVisible(false);
             playFrame.setSize(350,390);
              //--------------------------Order Bread----------------------------------
              //Declaring
              order = true;
              final ImageIcon whiteBImage = new ImageIcon("whiteB.jpg");
              final ImageIcon wheatBImage = new ImageIcon("wheatB.jpg");
              final ImageIcon italianBImage = new ImageIcon("italianB.jpg");
              final ImageIcon harvestBImage = new ImageIcon("harvestB.jpg");
              final JPanel bTopPanel = new JPanel(new GridLayout(0,2));
              final JPanel bCenterPanel = new JPanel(new FlowLayout());
              final JPanel bButtonPanel = new JPanel(new FlowLayout());
              final JPanel bMainPanel = new JPanel(new BorderLayout());
              final JLabel whiteBLabel = new JLabel(whiteBImage);
              final JLabel wheatBLabel = new JLabel(wheatBImage);
              final JLabel italianBLabel = new JLabel(italianBImage);
              final JLabel harvestBLabel = new JLabel(harvestBImage);
              final JLabel bInstrucTextLabel = new JLabel("Please click the button below a bread to choose", JLabel.CENTER);
              bTopPanel.add(whiteBLabel);
              bTopPanel.add(wheatBLabel);
              bTopPanel.add(whiteBreadButton);
              bTopPanel.add(wholeBreadButton);
              bTopPanel.add(italianBLabel);
              bTopPanel.add(harvestBLabel);
              bTopPanel.add(italianBreadButton);
              bTopPanel.add(harvestBreadButton);
              bCenterPanel.add(bInstrucTextLabel);
              bButtonPanel.add(goBackButton1);
              bMainPanel.add(bTopPanel, BorderLayout.NORTH);
              bMainPanel.add(bCenterPanel, BorderLayout.CENTER);
              bMainPanel.add(bButtonPanel, BorderLayout.SOUTH);
              bTopPanel.setPreferredSize(new Dimension(200, 270));
              bTopPanel.setMinimumSize(new Dimension(200,270));
              bTopPanel.setMaximumSize(new Dimension(200,270));
              bCenterPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));
              breadFrame.setContentPane(bMainPanel);
             breadFrame.setDefaultCloseOperation(breadFrame.EXIT_ON_CLOSE);
             breadFrame.pack();
             breadFrame.setVisible(false);
             breadFrame.setSize(350,390);
             //--------------------------Order Toppings----------------------------------
              //Declaring
              order = true;
              final JPanel tTopPanel = new JPanel(new FlowLayout());
              final JPanel tCenterPanel = new JPanel(new FlowLayout());
              final JPanel tActionPanel = new JPanel(new BorderLayout());
              final JPanel tButtonPanel = new JPanel(new FlowLayout());
              final JPanel tMainPanel = new JPanel(new BorderLayout());
              final JLabel tInstrucTextLabel = new JLabel("<html>Please select a topping from the drop down list above<br> and then click order</html>");
              //Creates list of toppings - file paths must match name
              String[] toppingStrings = { "Olives", "Tomatoes", "Lettuce", "Turkey", "Ham", "Select a Topping"};
              pictureTop = new JLabel();
              //Selects item at index 5
              toppingList = new JComboBox(toppingStrings);
              toppingList.setSelectedIndex(5);
              tActionPanel.add(toppingList , BorderLayout.NORTH);
              tActionPanel.add(pictureTop , BorderLayout.CENTER);
              tActionPanel.add(orderTopButton , BorderLayout.SOUTH);
              tCenterPanel.add(tInstrucTextLabel);
              tButtonPanel.add(goBackButton2);
              tMainPanel.add(tActionPanel , BorderLayout.NORTH);
              tMainPanel.add(tCenterPanel , BorderLayout.CENTER);
              tMainPanel.add(tButtonPanel , BorderLayout.SOUTH);
              //Must go in this method, do not put in main
              toppingList.addActionListener(this);
            pictureTop.setFont(pictureTop.getFont().deriveFont(Font.ITALIC));
            pictureTop.setHorizontalAlignment(JLabel.CENTER);
            updateLabel(toppingStrings[toppingList.getSelectedIndex()]);
            pictureTop.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
            //Preferred size - widest image and the height of the tallest image
            pictureTop.setPreferredSize(new Dimension(177, 132));
            tCenterPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));
              toppingFrame.setContentPane(tMainPanel);
             toppingFrame.setDefaultCloseOperation(toppingFrame.EXIT_ON_CLOSE);
             toppingFrame.pack();
             toppingFrame.setVisible(false);
             toppingFrame.setSize(350,390);
              //--------------------------Order Condiments----------------------------------
              //Declaring
              order = true;
              final ImageIcon condimentsImage = new ImageIcon("condiments.gif");
              final JPanel cTopPanel = new JPanel(new FlowLayout());
              final JPanel cCenterPanel = new JPanel(new FlowLayout());
              final JPanel cButtonPanel = new JPanel(new BorderLayout());
              final JPanel cMainPanel = new JPanel(new BorderLayout());
              final JLabel cInstrucTextLabel = new JLabel("<html>Please select a button below to order a Condiment</html>", JLabel.CENTER);
              final JLabel condimentsLabel = new JLabel(condimentsImage);
              cTopPanel.add(goBackButton3);
              cTopPanel.add(condimentsLabel);
              cCenterPanel.add(cInstrucTextLabel);
              cButtonPanel.add(mustardButton , BorderLayout.WEST);
              cButtonPanel.add(ketchupButton , BorderLayout.CENTER);
              cButtonPanel.add(relishButton , BorderLayout.EAST);
              cMainPanel.add(cTopPanel , BorderLayout.NORTH);
              cMainPanel.add(cCenterPanel , BorderLayout.CENTER);
              cMainPanel.add(cButtonPanel , BorderLayout.SOUTH);
              cCenterPanel.setBorder(BorderFactory.createTitledBorder("Instructions"));          
              condimentFrame.setContentPane(cMainPanel);
             condimentFrame.setDefaultCloseOperation(condimentFrame.EXIT_ON_CLOSE);
             condimentFrame.pack();
             condimentFrame.setVisible(false);
             condimentFrame.setSize(350,390);                    
              //--------------------------Confirmation Screen----------------------------------
              final JPanel coMainPanel = new JPanel(new BorderLayout());
              confirmTextLabel = new JLabel("<html>Would you like to purchase <u>" + itemName + "</u> <br>for a cost of <u>$" + Currency.format(itemCost) + "</u>?</html>", JLabel.CENTER);
              final JPanel coTopPanel = new JPanel(new FlowLayout());
              final JPanel coButtonPanel = new JPanel(new FlowLayout());
              final JPanel coCenterPanel = new JPanel(new FlowLayout());
              coTopPanel.add(goBackButton);
              coCenterPanel.add(confirmTextLabel);
              coButtonPanel.add(acceptButton);
              coButtonPanel.add(declineButton);
              coMainPanel.add(coTopPanel , BorderLayout.NORTH);
              coMainPanel.add(coCenterPanel , BorderLayout.CENTER);
              coMainPanel.add(coButtonPanel , BorderLayout.SOUTH);          
              coCenterPanel.setBorder(BorderFactory.createTitledBorder("Correct?"));     
              confirmFrame.setContentPane(coMainPanel);
             confirmFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             confirmFrame.pack();
             confirmFrame.setVisible(false);
             confirmFrame.setSize(350,390);
             //------------------------------Cart Screen----------------------------------
              final JPanel caMainPanel = new JPanel(new BorderLayout());
              final JPanel cartRPanel = new JPanel(new BorderLayout());
              final JPanel caButtonPanel = new JPanel(new FlowLayout());
              final JPanel caCenterPanel = new JPanel(new FlowLayout());
              caCenterPanel.add(cartRPanel);
              cartRPanel.add(cartItemLabel , BorderLayout.WEST);
              cartRPanel.add(cartPriceLabel , BorderLayout.EAST);
              caButtonPanel.add(goBackButton4);
              caButtonPanel.add(checkButton1);
              caMainPanel.add(caCenterPanel , BorderLayout.CENTER);
              caMainPanel.add(caButtonPanel , BorderLayout.SOUTH);          
              //cartItemLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
              //cartItemLabel.setHorizontalTextPosition(SwingConstants.LEFT);
              caCenterPanel.setBorder(BorderFactory.createTitledBorder("Your Items"));     
              cartFrame.setContentPane(caMainPanel);
             cartFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             cartFrame.pack();
             cartFrame.setVisible(false);
             cartFrame.setSize(350,390);     
             //--------------------------End of Constructive Method---------------------------
         //Updates the label when combo box is changed
         protected void updateLabel(String name)
            ImageIcon icon = createImageIcon("images/" + name + ".jpg");
            //Sets the image of the icon
            pictureTop.setIcon(icon);
            if (icon != null)
                pictureTop.setText(null);
            else
                pictureTop.setText("Image not found");
        //Returns an ImageIcon, or null if the path was invalid to the icon
        protected static ImageIcon createImageIcon(String path)
            java.net.URL imgURL = AdrianP1.class.getResource(path);
            if (imgURL != null)
                return new ImageIcon(imgURL);
            else
                 //Prints out if file is not found in system window
                System.out.println("Couldn't find file: " + path);
                return null;
         public void updateConfirm()
              //------------------NOT IN USE-------------------
              if(whiteB==true)
                   itemName = "White Bread";
                   itemCost = bwCost;
              if(wholeB==true)
              if(italB==true)
              if(harvestB==true)
              //------------------NOT IN USE-------------------
         public void receiptPrint ()
              //------------------NOT IN USE-------------------
              final JLabel receiptLabel = new JLabel("<html>Your PST:<br>Your GST:<br>Your Total:</html>");
              final JPanel receiptPanel = new JPanel(new FlowLayout());
              receiptPanel.add(receiptLabel);
              receiptLabel.setFont(new Font("Serif", Font.PLAIN, 15));
              receiptPanel.setBorder(BorderFactory.createTitledBorder("Your Receipt"));
              //------------------NOT IN USE-------------------
    }

    I'm certainly not going to read all of that, perhaps someone else here will.You really think so? I seriously doubt it.
    @OP: Please go through these links:
    [How to ask questions the smart way|http://catb.org/~esr/faqs/smart-questions.html]
    SSCCE
    db

  • Help!!! How do I print out a 2d Array?

    Say, I have
    static int[][] board = { {p,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r},
    {n,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r} };
    where,
    private static int w = 0; //Block
    private static int f = 1; //Movable Block
    private static int c = 2; //bomb
    private static int n = 3; //nothing
    private static int p = 4;
    private static int r =(int) Math.random()%4;
    How do I print out this 2 d array so it looks like
    Where all these stars are numbers...

    for (int i = 0; i < board.length; i ++)
    for (int j = 0; j < board.length; j ++)
    System.out.print (((j == 0) ? "" : ", ") + board[i][j]);
    System.out.println ();
    I think your random generator is not quite correct as the seed will always be the same causing you to have same random number. try to work that out...

  • How to print out the position of 2 dimension arrays?

    there are 2 dimension arrays, how can print out the position of value than 4?
    for example
    0 2 3 2 2 2
    0 1 1 2 5 3
    1 2 3 3 2 1
    print out:
    The pos is ( 5,2).

    Hello
    If I understand your question correctly, you are trying to print out the indexes where the value in your matrix is greater than 4
    If this is the case, then what you need to use is nested for loops e.g.
    for (int i = 0; i< array[0].length; i++)
    for (int j = 0; j< array[].length; j++)
    int value = array[i][j];
    if (value > 4)
    System.out.println("The pos is (" + i + "," + j + ")" );
    Regarding the syntax I have used to get the size of the array, I am not sure if this is correct, but you should have an idea of what I am doing.
    Sajid

  • Printing from forte

    Hi there
    We have the situation where we have a printer shared on NT 4.0 , the client
    on windows 2000 (forte 3.0.L) .
    When they go into forte and look for the default printer (through the forte
    window - print setup) , there is no printer . Therefore if they try to print
    they receive no printout .
    There is a default printer and printing can be done from other applications
    They go out of the forte application and back in and the printer is there
    and printing works.
    Has anybody experienced this ?
    Thanks very much
    Jenni Els
    WARNING:
    Any unauthorised use or interception of this email is illegal. If this email
    is not intended for you, you may not copy, distribute nor disclose the
    contents to anyone. Save for bona fide company matters, the BoE Group does
    not accept any responsibility for the opinions expressed in this email.
    For further details please see: http://www.nbs.co.za/emaildisclaim.htm

    Hi,
    I encountered the same problem printing report with gray areas with Forte'
    3.0.G. Your suggestion is really good.
    We can't print our reports with a monitor resolution of 256 colors (gray
    sessions are totally black) but we produced good reports with gray sessions
    with monitor resolution of 65000 colors.
    Thanks
    Alessandra
    Alessandra Solano
    CSI PIEMONTE
    Torino - Italy
    MailTo: [email protected]
    [email protected] il 22/10/98 17.50.59
    Rispondere, prego a [email protected]
    Per: [email protected]
    cc: (ccr: Alessandra Solano/CSI/IT)
    Oggetto: Printing from a Forte application
    Hi,
    I am asking this question on behalf of a friend of mine.
    He has a Forte application that formats a report layout and prints to a
    printer. When the monitor color is set at 256 colors, this report prints
    out totally black. (It prints properly if the color is set to 16 bit). This
    report uses about 10 arrays with about 15 records each. The really
    interesting thing is that if he removes 9 of those arrays, the report
    prints without a problem. He is suspecting memory problems but would like
    to know if anybody else has encountered problems with their application
    trying to print to a printer and the resolution, if any. He has installed
    Forte 3.0.G.
    Any help would be appreciated.
    Thanks,
    Anand.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • How t print out selected values from a Jlist

    hi iam trying to get the selected values from a list to print out as a string but iam getting ,Invalid cast from java.lang.Object[] to java.lang.String.is there any way to get the selected values t print ut as a string?? import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MultipleSelection2 extends JFrame {
    private JList colorList, copyList;
    private JButton copy;
    private String colorNames[] =
    { "Black", "Blue", "Cyan", "Dark Gray", "Gray",
    "Green", "Light Gray", "Magenta", "Orange", "Pink",
    "Red", "White", "Yellow" };
    public MultipleSelection2()
    super( "Multiple Selection Lists" );
    Container c = getContentPane();
    c.setLayout( new FlowLayout() );
    colorList = new JList( colorNames );
    colorList.setVisibleRowCount( 5 );
    colorList.setFixedCellHeight( 15 );
    colorList.setSelectionMode(
    ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
    c.add( new JScrollPane( colorList ) );
    // create copy button
    copy = new JButton( "Copy >>>" );
    copy.addActionListener(
    new ActionListener() {
    public void actionPerformed( ActionEvent e )
    // place selected values in copyList
    copyList.setListData(
    colorList.getSelectedValues());
    String s1 =(String)colorList.getSelectedValues();

    Since the JList method 'getSelectedValues' returns an object array you'll need to iterate through the array and cast each object in the array to a string as you access them.
    Object[] o = colorList.getSelectedValues();
    for(int count=0,end=o.length; count<end; count++) {
    String s = (String) o[count];
    Hope that helps
    Talden

  • Printing out results in case of object-relational table (Oracle)

    I have made a table with this structure:
    CREATE OR REPLACE TYPE Boat AS OBJECT(
    Name varchar2(30),
    Ident number,
    CREATE OR REPLACE TYPE Type_boats AS TABLE OF Boat;
    CREATE TABLE HOUSE(
    Name varchar2(40),
    MB Type_boats)
    NESTED TABLE MB store as P_Boat;
    INSERT INTO House VALUES ('Name',Type_boats(Boat('Boat1', 1)));
    I am using java to print out all the results by calling a procedure.
    CREATE OR REPLACE package House_boats
    PROCEDURE add(everything works here)
    PROCEDURE results_view;
    END House_boats;
    CREATE OR REPLACE Package.body House_boats AS
    PROCEDURE add(everything works here) AS LANGUAGE JAVA
    Name House_boats.add(...)
    PROCEDURE results_view AS LANGUAGE JAVA
    Name House_boats.resuts_view();
    END House_boats;
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    CALL House_boats.results_view();
    House_boats.java file which is loaded using LOADJAVA:
    import java.sql.*;
    import java io.*;
    public class House_boats {
    public static void results_view ()
       throws SQLException
       { String sql =
       "SELECT * from House";
       try { Connection conn = DriverManager.getConnection
    ("jdbc:default:connection:");
       PreparedStatement pstmt = conn.prepareStatement(sql);
       ResultSet rset = pstmt.executeQuery();
      printResults(rset);
      rset.close();
      pstmt.close();
       catch (SQLException e) {System.err.println(e.getMessage());
    static void printResults (ResultSet rset)
       throws SQLException { String buffer = "";
       try { ResultSetMetaData meta = rset.getMetaData();
       int cols = meta.getColumnCount(), rows = 0;
       for (int i = 1; i <= cols; i++)
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       if (label.length() > size) size = label.length();
       while (label.length() < size) label += " ";
      buffer = buffer + label + " "; }
      buffer = buffer + "\n";
       while (rset.next()) {
      rows++;
       for (int i = 1; i <= cols; i++) {
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       String value = rset.getString(i);
       if (label.length() > size) size = label.length();
       while (value.length() < size) value += " ";
      buffer = buffer + value + " ";  }
      buffer = buffer + "\n";   }
       if (rows == 0) buffer = "No data found!\n";
       System.out.println(buffer); }
       catch (SQLException e) {System.err.println(e.getMessage());}  }
    How do I print out the results correctly in my case of situation?
    Thank you in advance

    I have made a table with this structure:
    I am using java to print out all the results by calling a procedure.
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    How do I print out the results correctly in my case of situation?
    There are several things wrong with your code and methodology
    1. The code you posted won't even compile because there are several syntax issues.
    2. You are trying to use/test Java in the database BEFORE you get the code working outside the DB
    3. Your code is not using collections in JDBC properly
    I suggest that you use a different, proven approach to developing Java code for use in the DB
    1. Use SIMPLE examples and then build on them. In this case that means don't add collections to the example until ALL other aspects of the app work properly.
    2. Create and test the Java code OUTSIDE of the database. It is MUCH easier to work outside the database and there are many more tools to help you (e.g. NetBeans, debuggers, DBMS_OUTPUT windows, etc). Trying to debug Java code after you have already loaded it into the DB is too difficult. I'm not aware of anyone, even at the expert level, that develops that way.
    3. When using complex functionality like collections first read the Oracle documentation (JDBC Developer Guide and Java Developer's Guide). Those docs have examples that are known to work.
    http://docs.oracle.com/cd/B28359_01/java.111/b31225/chfive.htm
    http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraarr.htm#sthref583
    The main issue with your example is #3 above; you are not using collections properly:
    String value = rset.getString(i);
    A collection is NOT a string so why would you expect that to work for a nested table?
    A collection needs to be treated like a collection. You can even treat the collection as a separate result set. Create your code outside the database and use the debugger in NetBeans (or other) on this replacement code for your 'printResults' method:
    static void printResults (ResultSet rset) throws SQLException {
        try {
           ResultSetMetaData meta = rset.getMetaData();
           while (rset.next()) {
               ResultSet rs = rset.getArray(2).getResultSet();
               rs.next();
               String ndx = rs.getString(1);
               Struct struct = (Struct) rs.getObject(2);
               System.out.println(struct.getSQLTypeName());
               Object [] oa = struct.getAttributes();
               for (int j = 0; j < oa.length; j++) {
                  System.out.println(oa[j]);
        } catch  (SQLException e) {
           System.err.println(e.getMessage());
    That code ONLY deals with column 2 which is the nested table. It gets that collection as a new resultset ('rs'). Then it gets the contents of that nested table as an array of objects and prints out the attributes of those objects so you can see them.
    Step through the above code in a debugger so you can SEE what is happening. NetBeans also lets you enter expressions such as 'rs' in an evaluation window so you can dynamically try the different methods to see what they do for you.
    Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
    Since your current issue has nothing to do with this forum I suggest that you mark this thread ANSWERED and repost it in the JDBC forum if you need further help with this issue.
    https://forums.oracle.com/community/developer/english/java/database_connectivity
    When you repost you can include a link to this current thread if you want. Once your Java code is actually working then try the Java Stored procedure examples in the Java Developer's Guide doc linked above.
    At the point you have any issues that relate to Java stored procedures then you should post them in the SQL and PL/SQL forum
    https://forums.oracle.com/community/developer/english/oracle_database/sql_and_pl_sql

  • Printing a 2d array in matrix format

    Hi everyone- first time posting here... I'm an undergrad CS major at the Colorado School of Mines. I'm trying to write a metho that will print out a 2D array (3x3) in matrix form. Here is what I have:
    public static void printArray(int[][]array3){
    for (int i=0; i<array3.length; i++)
    for (int j = 0; j<array3[0].length; j++) {
    int count=0;
    if (count % 3 ==0){
    System.out.println(array3[i][j] + " ");
    count++;
    else{
    System.out.print(array3[i][j] + " ");
    count++;
    All it does is list the elements of the array as follows.
    Sample:
    1, 2, 3 input array
    prints:
    1
    2
    3
    Any help would be appreciated.

    1 public static void printArray(int[][]array3){
    2       for (int i=0; i<array3.length; i++)
    3         for (int j = 0; j<array3[0].length; j++) {
    4           int count=0;
    5           if (count % 3 ==0){
    6             System.out.println(array3[i][j] + " ");
    7             count++;
    8           }
    9           else{
    10             System.out.print(array3[i][j] + " ");
    11             count++;
    12           }
    13         }
    14     }Lets just run through it, step by step
    -1
       i = Out of scope
       j = out of scope
       count = out of scope
    -2
       i = 0
       j = out of scope
       count = out of scope
    -3
       i = 0
       j = 0
       count = out of scope
    -4
       i = 0
       j = 0
       count = 0
    -5
       i = 0
       j = 0
       count = 0
       (count % 3 ) = 0
    -6
       i = 0
       j = 0
       count = 0
       print 1<new line>
    -7
       i = 0
       j = 0
       count = 1
    -8
       i = 0
       j = 0
       count = 1
    -13
       i = 0
       j = 0
       count = out of scope
    -3
       i = 0
       j = 1
       count = out of scope
    -4
       i = 0
       j = 1
       count = 0Hint: You don't need count, you have a counter (i*3)+j, and even a counter than just goes between 0 to 2.

  • Print out some numbers

    Hello:
    At the movement I got array nums[]={"1", "2", "3", "4", "5", "6", "7", "8"},
    Please tell me how to print out some numbers from the array by using for loop, and the result exactly like System.out.println( " 1 2 3 4 "); System.out.println(" 5 6 7 8);
    Please run my codeing first, I'd like the result exactly same as my coding showing.
    Thanks
    import java.awt.*;
    public class Test{
    private static Test t;
    private static String nums[]={"1", "2", "3", "4", "5", "6", "7","8"};
    public static void main(String [] args){
         t=new Test();
    private Test(){
         print();
    private void print(){
         System.out.println(" 1 2 3 4 ");
         System.out.println(" 5 6 7 8 ");
    }

    Ugh!
    I didn't see that you wanted 1,2,3,4 and 5,6,7,8 on new lines. This will do the trick. It's ugly but it works.
    public class Test
        private static Test t;
        private static String nums[] = {"1", "2", "3", "4", "5", "6", "7", "8"};
        public static void main( String[] args )
            new Test();
        private Test()
            print();
        private void print()
            for (int i = 0; i < nums.length; i++) {
                if (i == 4) {
                    // Print a Blank Line
                    System.out.println("");
                String num = nums;
    System.out.print(num + " ");
    cheers,
    Greg

  • Printing out a diamond shape

    I am in an intro Java course and the instructor asked us to write a program that prints out a diamond shape using the * symbol.
    I have been racking my brain for hours and I cannot figure it out.
    We must use the Scanner class.
    Also, we only have been taught the:
    if
    if else if
    while
    do while
    for
    printf
    and a very basic array
    PLEASE HELP...THIS IS DUE THURSDAY!!!!

    I am in an intro Java course and the instructor asked
    us to write a program that prints out a diamond shape
    using the * symbol.Okay.
    So, ignore Java for the moment.
    Break the problem down into pieces. I have to assume that you must have some idea on how to do some of it. If not, speak to your instructor.
    How would you tell somebody to do it if you had to write down the directions, and that person was going to write it with pencil & paper?
    That person doesn't know what a diamond is, and he will do exactly what you tell him, but you must make your instructions simple and precise. You can tell him in English, pseudocode, or a combination--whatever is easiest for you.
    Do this first. If you can't do this, then you can't write it in Java.
    Once you do that, work on translating those steps to Java.
    I have been racking my brain for hours and I cannot
    figure it out.What, precisely can't you figure out? There are several steps here (as you'll see when you do the above exercise). Which of them are giving you trouble? If you can't even write the steps, or can't translate any of them, then you need to speak to your instructor, or engage the services of a private tutor.
    >
    We must use the Scanner class.Okay.
    Do you know how to use that class? Can you think of a step in your program where it might be useful?
    Also, we only have been taught the:
    if
    if else if
    while
    do while
    for
    printf
    and a very basic arrayYou don't need more than that. (Assuming you also know how to define classes, methods, and variables. You can't do anything in Java without that.)
    PLEASE HELP...THIS IS DUE THURSDAY!!!!Okay. But nobody who's going to help you here cares about your deadline. Managing your time is entirely your issue. We'll help you with the technical stuff, on our own scheule.

  • Printing out to a gui

    Hi,
    Can someone give me a hand with this??
    for (int b = 0; b < a.length; b++)
              ta = new JTextArea(a);
    this is going through my array of names and I want them to print out but when I run the program it keeps over writing the line and I end up with just the last name on the screen. Any ideas??
    Thanks
    DeeSheehan

    Dude, come up with some more descriptive variable names, at least call the array names or something, not b
    In every pass of the loop you create a new JTextArea and assign it to ta, thus overwriting what was there before. Of course you only end up with the last one after the loop.

Maybe you are looking for

  • Ical will not allow me to add a new event

    I have tried to both double click (and nothing happens) as well as right click and add "New Event" but again nothing happens. I went into my Library and delted my cache, deleted then re-signed into my iCloud account, and checked for updates. Anyone e

  • CX_SY_READ_SRC_LINE_TOO_LONG what does it mean ?

    Hello all. I've got the problem with FM 'REUSE_ALV_FIELDCATALOG_MERGE'. My report always fails at calling this FM. Here is the part of error message that i get: An exception occurred. This exception is dealt with in more detail below       . The exce

  • Problem using RescaleOp to brighten image

    Hi, I'm trying to use java.awt.image.RescaleOp to brighten or darken an image. My code: (Using java.awt.image.BufferedImage, java.awt.RenderingHints)      protected static Image createBrightImage(Graphics g, BufferedImage bi)           float scaleFac

  • I've lost the ability to see my second monitor

    After installing Mavericks

  • I want to move my CS5 to a new computer

    I have my purchased copy of CS5 from a couple years ago, which I downloaded. My laptop is getting kind of tired, so thinking about upgrading to something new. I need to know if and how I can move my CS5 over to the new computer. Happy to delicence th