Trouble using exists() from File Class

I'm trying to have the user input a filename, and then I'm storing the filename in a file object called childFile.
I'm having trouble with the conditional and boolean statements. The screen should print "I'm real" if the file exists, but it doesn't. It prints I don't exist every time, no matter what the user inputs.
I really appreciate any help.
import java.io.*;
import java.util.Scanner;
public class FileObject {
     public static void main(String[] args)
     throws java.io.IOException
          //boolean childFile.exists() = true;
          Scanner keyboard = new Scanner( System.in );
          System.out.print("Please enter the name of an existing file: ");
          String input = keyboard.nextLine().trim();
          File childFile = new File (input);
          File parentFile = new File( childFile.getCanonicalFile().getParent() );
          boolean exists = childFile.exists();
          if (exists)
               System.out.println("I'm real.");
          else
               System.out.println("I don't exist");
          System.out.println(childFile);
          System.out.println(parentFile);
          //displayFiles(list.listFiles(), indent + " ");
     //void displayFiles(File[]list, String indent) {

Use File.getAbsolutePath() to make sure your file is actually pointing where you think it's pointing

Similar Messages

  • Adcfgclone.pl  with using existing context file

    Hi,
    I want to clone application server with using existing context file. can I do adcfgclone.pl with using existing context file?
    What is the syntax ?
    is there any issue to use this?
    thanks

    Actually I want to clone existing enviornment of R12.0.6 application to fix local inventory issue.
    Problem: During r12.1.3 upgrade I noticed that local inventory has issue. R12.1.3 upgrade was done succssfully after clone of production. When I started upgrade on production I noticed issue during 10.1.3.4 upgrade. Thats why I thought if I clone existing production enviornment on same server by using same context file then 10.1.3.4 upgrade will run.
    I know there is a way to fix inventory but I don't want to do to avaoid more issue. Please advice which path is good in such enviornment.Are you referring to global inventory? If yes, you can simply copy it from the source servers to the target ones.
    If the PATHs are different then please refer to:
    How to Create a Clean oraInventory in Release 12 [ID 834894.1]
    How to find the location of GLOBAL Inventory and LOCAL inventory on R12.x ? Why Some Times, There are Issues With The oraInventory Registration During The Post Clone ? [ID 878717.1]
    Thanks,
    Hussein

  • Load xml file using gerResource() from a class in jar

    Hi,
    I have a jar file. I set the classpath for the jar.
    I have an xml file in the directory of jar.
    ex: /example/test.jar (jar file)
    /example/test/test.xml
    I would like to load the xml file by using a class in the jar file like:
    URL url = Test.class.getResource("/example/test/test.xml");
    Test.class is in the jar.
    But it is not loading and giving URL as null.
    I couldnot figure out how to load any file outside of the jar file from a class file in the jar.
    Any solution can be appreciated.
    Thanx in advance.
    Sridhar

    Try
        URL url = ClassLoader.getSystemResource ("/example/test/test.xml");

  • How do i use objects from one class in anohter?

    Hey
    I have two GUI classes ShowWhiteGUI and BasketGUI and then a control class ShowWhite. The control class calls all the method from anohter class's which the GUI classes are gonna use.
    The basis idea with this script is it shall be a very very simpel Shop. Where you can add items to a basket and then show the items in a new window(BasketGUI).
    So here is the problem. I cant create an object in both GUI classes, because then im working with two sets of data, right? So how do i do this?
    Here is my code:
    ShowWhiteGUI
    * ShowWhiteGUI.java
    * Created on 5. februar 2008, 10:43
    package userclasses;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    * @author  Lille mus
    public class ShowWhiteGUI extends javax.swing.JFrame {
        private BasketGUI basketGUI;
        private ShowWhite control;
        /** Creates new form ShowWhiteGUI */
        public ShowWhiteGUI() {
            basketGUI = new BasketGUI();
            control = new ShowWhite();
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            aboutDialog = new javax.swing.JDialog();
            jLabel1 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            itemIdField = new javax.swing.JTextField();
            productIdLabel = new javax.swing.JLabel();
            numberOfItems = new javax.swing.JLabel();
            productId = new javax.swing.JTextField();
            basketButton = new javax.swing.JButton();
            jLabel2 = new javax.swing.JLabel();
            showBasketButton = new javax.swing.JButton();
            jMenuBar1 = new javax.swing.JMenuBar();
            menu = new javax.swing.JMenu();
            jMenu1 = new javax.swing.JMenu();
            open = new javax.swing.JMenuItem();
            quit = new javax.swing.JMenuItem();
            jMenuItem1 = new javax.swing.JMenuItem();
            jMenu2 = new javax.swing.JMenu();
            help = new javax.swing.JMenuItem();
            about = new javax.swing.JMenuItem();
            javax.swing.GroupLayout aboutDialogLayout = new javax.swing.GroupLayout(aboutDialog.getContentPane());
            aboutDialog.getContentPane().setLayout(aboutDialogLayout);
            aboutDialogLayout.setHorizontalGroup(
                aboutDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 400, Short.MAX_VALUE)
            aboutDialogLayout.setVerticalGroup(
                aboutDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 300, Short.MAX_VALUE)
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Show White's Shop");
            setBackground(new java.awt.Color(0, 102, 255));
            jLabel1.setFont(new java.awt.Font("Baby Kruffy", 0, 36));
            jLabel1.setText("Snow White?s Shop");
            jTextArea1.setColumns(20);
            jTextArea1.setEditable(false);
            jTextArea1.setRows(5);
            jTextArea1.setText(control.getPrintAllStockItems());
            jScrollPane1.setViewportView(jTextArea1);
            productIdLabel.setText("Varenummer:");
            numberOfItems.setText("Antal:");
            basketButton.setText("L?g i kurv");
            basketButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    putInBasket(evt);
            showBasketButton.setText("Vis indk?bskurv");
            showBasketButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    showBasket(evt);
            menu.setLabel("Fil");
            jMenu1.setText("Menu");
            menu.add(jMenu1);
            open.setLabel("?bn");
            open.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    open(evt);
            menu.add(open);
            quit.setLabel("Luk");
            quit.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    quit(evt);
            menu.add(quit);
            jMenuItem1.setLabel("Gem");
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    save(evt);
            menu.add(jMenuItem1);
            jMenuBar1.add(menu);
            jMenu2.setLabel("Hj?lp");
            help.setLabel("Hj?lp");
            help.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    help(evt);
            jMenu2.add(help);
            about.setLabel("Om Show White Shop");
            jMenu2.add(about);
            jMenuBar1.add(jMenu2);
            setJMenuBar(jMenuBar1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(37, 37, 37)
                            .addComponent(jLabel1))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addComponent(productIdLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(numberOfItems))
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(productId, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
                                        .addComponent(basketButton))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(31, 31, 31)
                                        .addComponent(jLabel2)))
                                .addGroup(layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(showBasketButton)))))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel2))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(productIdLabel)
                                .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(numberOfItems)
                                .addComponent(productId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(showBasketButton)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 202, Short.MAX_VALUE)
                            .addComponent(basketButton)))
                    .addContainerGap())
            pack();
        }// </editor-fold>                       
        public void createBasketWindow(){
            basketGUI.setVisible(true);
        private void showBasket(java.awt.event.ActionEvent evt) {                           
            createBasketWindow();
        private void putInBasket(java.awt.event.ActionEvent evt) {                            
            Integer itemId = Integer.parseInt(itemIdField.getText());
            String petToAdd = control.getFindItem(itemId);
            System.out.println(petToAdd);
            control.setAddItemToBasket(itemId);
            basketGUI.addPetToBasket(petToAdd);     
        private void help(java.awt.event.ActionEvent evt) {                     
        private void save(java.awt.event.ActionEvent evt) {                     
            System.out.println("Gemmer fil");
        private void open(java.awt.event.ActionEvent evt) {                     
            System.out.println("?bn fil");
        private void quit(java.awt.event.ActionEvent evt) {                     
            System.exit(0);
        public ShowWhite getControl(){
            return control;
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new ShowWhiteGUI().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JMenuItem about;
        private javax.swing.JDialog aboutDialog;
        private javax.swing.JButton basketButton;
        private javax.swing.JMenuItem help;
        private javax.swing.JTextField itemIdField;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JMenu jMenu1;
        private javax.swing.JMenu jMenu2;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenuItem jMenuItem1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JMenu menu;
        private javax.swing.JLabel numberOfItems;
        private javax.swing.JMenuItem open;
        private javax.swing.JTextField productId;
        private javax.swing.JLabel productIdLabel;
        private javax.swing.JMenuItem quit;
        private javax.swing.JButton showBasketButton;
        // End of variables declaration                  
    }BasketGUI:
    * Basket.java
    * Created on 5. februar 2008, 15:29
    package userclasses;
    import javax.swing.JTextArea;
    * @author  Lille mus
    public class BasketGUI extends javax.swing.JFrame {
        private String newline = "\n";
        private InvoiceGUI invoiceGUI;
        /** Creates new form Basket */
        public BasketGUI() {       
            initComponents();
            //invoiceGUI = new InvoiceGUI();
        public void addPetToBasket(String pet){
            jTextArea1.append(pet+newline);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            jLabel1 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            jButton1 = new javax.swing.JButton();
            itemIdField = new javax.swing.JTextField();
            jLabel2 = new javax.swing.JLabel();
            removeItemButton = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Indk?bskurv");
            jLabel1.setText("Indk?bskurv");
            jTextArea1.setColumns(20);
            jTextArea1.setRows(5);
            jScrollPane1.setViewportView(jTextArea1);
            jButton1.setText("K?b og print kvittering");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    printInvoice(evt);
            jLabel2.setText("Slet varenr");
            removeItemButton.setText("Slet");
            removeItemButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    removeItemFromBasket(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(21, 21, 21)
                            .addComponent(jLabel1))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 141, Short.MAX_VALUE)
                                    .addComponent(jButton1))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(removeItemButton)))))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel1)
                    .addGap(20, 20, 20)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jButton1)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 125, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(removeItemButton))
                    .addContainerGap())
            pack();
        }// </editor-fold>                       
        private void removeItemFromBasket(java.awt.event.ActionEvent evt) {                                     
            Integer itemId = Integer.parseInt(itemIdField.getText());
        private void printInvoice(java.awt.event.ActionEvent evt) {                             
            //invoiceGUI.setVisible(true);
        public JTextArea getTextArea(){
            return jTextArea1;
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new BasketGUI().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JTextField itemIdField;
        private javax.swing.JButton jButton1;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JButton removeItemButton;
        // End of variables declaration                  
    }ShowWhite:
    * ShowWhite.java
    * Created on 13. februar 2008, 18:15
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package userclasses;
    * @author Lille mus
    public class ShowWhite {
        public Basket basket;
        public Stock stock;
        /** Creates a new instance of ShowWhite */
        public ShowWhite() {
            stock = new Stock();
            basket = new Basket();
        public String getFindItem(int itemId){
            String returnItem = stock.findItem(itemId);
            return returnItem;
        public void setAddItemToBasket(int itemId){
            basket.addItemToBasket(itemId);
        public String getPrintAllStockItems(){
            return stock.printAllStockItems();
        public String getShowBasket(){
             return basket.showBasket();
        public void setRemoveItemFromBasket(int itemId){
            basket.removeItemFromBasket(itemId);
    }

    okay i tried this, but it give me a nullpointerexeption:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at userclasses.ShowWhiteGUI.initComponents(ShowWhiteGUI.java:75)
    at userclasses.ShowWhiteGUI.<init>(ShowWhiteGUI.java:21)
    at userclasses.ShowWhite.<init>(ShowWhite.java:26)
    at userclasses.Main.<init>(Main.java:16)
    at userclasses.Main$1.run(Main.java:31)
    ShowWhite
    public class ShowWhite {
        public Basket basket;
        public Stock stock;
        private ShowWhiteGUI mainGUI;
        private BasketGUI basketGUI;
        /** Creates a new instance of ShowWhite */
        public ShowWhite() {
            stock = new Stock();
            basket = new Basket();
            mainGUI = new ShowWhiteGUI(this);
            basketGUI = new BasketGUI();
        public String getFindItem(int itemId){
            String returnItem = stock.findItem(itemId);
            return returnItem;
        public void setAddItemToBasket(int itemId){
            basket.addItemToBasket(itemId);
        public String getPrintAllStockItems(){
            return stock.printAllStockItems();
        public String getShowBasket(){
             return basket.showBasket();
        public void setRemoveItemFromBasket(int itemId){
            basket.removeItemFromBasket(itemId);
        public void createMainGUI(){
            mainGUI.setVisible(true);
        public BasketGUI getBasketGUI(){
            return basketGUI;
        public void setAddPetToBasket(String pet){
            basketGUI.addPetToBasket(pet);
    }ShowWhiteGUI:
    public class ShowWhiteGUI extends javax.swing.JFrame {
        private ShowWhite control;
        /** Creates new form ShowWhiteGUI */
        public ShowWhiteGUI(ShowWhite control) {
            initComponents();
            this.control = control;
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
        private void initComponents() {
            aboutDialog = new javax.swing.JDialog();
            jLabel1 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            itemIdField = new javax.swing.JTextField();
            productIdLabel = new javax.swing.JLabel();
            numberOfItems = new javax.swing.JLabel();
            productId = new javax.swing.JTextField();
            basketButton = new javax.swing.JButton();
            jLabel2 = new javax.swing.JLabel();
            showBasketButton = new javax.swing.JButton();
            jMenuBar1 = new javax.swing.JMenuBar();
            menu = new javax.swing.JMenu();
            jMenu1 = new javax.swing.JMenu();
            open = new javax.swing.JMenuItem();
            quit = new javax.swing.JMenuItem();
            jMenuItem1 = new javax.swing.JMenuItem();
            jMenu2 = new javax.swing.JMenu();
            help = new javax.swing.JMenuItem();
            about = new javax.swing.JMenuItem();
            javax.swing.GroupLayout aboutDialogLayout = new javax.swing.GroupLayout(aboutDialog.getContentPane());
            aboutDialog.getContentPane().setLayout(aboutDialogLayout);
            aboutDialogLayout.setHorizontalGroup(
                aboutDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 400, Short.MAX_VALUE)
            aboutDialogLayout.setVerticalGroup(
                aboutDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 300, Short.MAX_VALUE)
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Show White's Shop");
            setBackground(new java.awt.Color(0, 102, 255));
            jLabel1.setFont(new java.awt.Font("Baby Kruffy", 0, 36));
            jLabel1.setText("Snow White?s Shop");
            jTextArea1.setColumns(20);
            jTextArea1.setEditable(false);
            jTextArea1.setRows(5);
            jTextArea1.setText(control.getPrintAllStockItems());
            jScrollPane1.setViewportView(jTextArea1);
            productIdLabel.setText("Varenummer:");
            numberOfItems.setText("Antal:");
            basketButton.setText("L?g i kurv");
            basketButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    putInBasket(evt);
            showBasketButton.setText("Vis indk?bskurv");
            showBasketButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    showBasket(evt);
            menu.setLabel("Fil");
            jMenu1.setText("Menu");
            menu.add(jMenu1);
            open.setLabel("?bn");
            open.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    open(evt);
            menu.add(open);
            quit.setLabel("Luk");
            quit.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    quit(evt);
            menu.add(quit);
            jMenuItem1.setLabel("Gem");
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    save(evt);
            menu.add(jMenuItem1);
            jMenuBar1.add(menu);
            jMenu2.setLabel("Hj?lp");
            help.setLabel("Hj?lp");
            help.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    help(evt);
            jMenu2.add(help);
            about.setLabel("Om Show White Shop");
            jMenu2.add(about);
            jMenuBar1.add(jMenu2);
            setJMenuBar(jMenuBar1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(37, 37, 37)
                            .addComponent(jLabel1))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addComponent(productIdLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(numberOfItems))
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(productId, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
                                        .addComponent(basketButton))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(31, 31, 31)
                                        .addComponent(jLabel2)))
                                .addGroup(layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(showBasketButton)))))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel2))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(productIdLabel)
                                .addComponent(itemIdField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(numberOfItems)
                                .addComponent(productId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(showBasketButton)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 202, Short.MAX_VALUE)
                            .addComponent(basketButton)))
                    .addContainerGap())
            pack();
        }// </editor-fold>                       
        public void createBasketWindow(){
            control.getBasketGUI().setVisible(true);
        private void showBasket(java.awt.event.ActionEvent evt) {                           
            createBasketWindow();
        private void putInBasket(java.awt.event.ActionEvent evt) {                            
            Integer itemId = Integer.parseInt(itemIdField.getText());
            String petToAdd = control.getFindItem(itemId);
            System.out.println(petToAdd);
            control.setAddItemToBasket(itemId);
            control.setAddPetToBasket(petToAdd);     
        private void help(java.awt.event.ActionEvent evt) {                     
        private void save(java.awt.event.ActionEvent evt) {                     
            System.out.println("Gemmer fil");
        private void open(java.awt.event.ActionEvent evt) {                     
            System.out.println("?bn fil");
        private void quit(java.awt.event.ActionEvent evt) {                     
            System.exit(0);
        public ShowWhite getControl(){
            return control;
        // Variables declaration - do not modify                    
        private javax.swing.JMenuItem about;
        private javax.swing.JDialog aboutDialog;
        private javax.swing.JButton basketButton;
        private javax.swing.JMenuItem help;
        private javax.swing.JTextField itemIdField;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JMenu jMenu1;
        private javax.swing.JMenu jMenu2;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenuItem jMenuItem1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JMenu menu;
        private javax.swing.JLabel numberOfItems;
        private javax.swing.JMenuItem open;
        private javax.swing.JTextField productId;
        private javax.swing.JLabel productIdLabel;
        private javax.swing.JMenuItem quit;
        private javax.swing.JButton showBasketButton;
        // End of variables declaration                  
    }

  • Trouble Using DataProvider in External Class

    Hello,
    I am creating a Flash form which will include a drop-down selection menu from which a user may choose their state. I originally accomplished this by adding a ComboBox to the stage and then populated the ComboBox's DataProvider object with an XML listing of all the state names and the corresponding values. Everything works as expected.
    I have decided, however, that it would make the most sense to create an external class to accomplish the same thing. I have attempted to create such a class using the following code:
    package {
    import fl.data.DataProvider;
    import fl.controls.ComboBox;
    public class StateSelectionList extends ComboBox {
    private var xml:XML;
    private var dp:DataProvider;
    private var cb:ComboBox;
    public function StateSelectionList() {
    xml = <states>
    <state name="AL - ALABAMA" value="AL" />
    <state name="AK - ALASKA" value="AK" />
    <state name="AZ - ARIZONA" value="AZ" />
    </states>;
    dp = new DataProvider(xml);
    cb = new ComboBox();
    cb.dataProvider = dp;
    cb.labelField = "name";
    I then attempted to use this class in my Flash file by adding a ComboBox component to my library and then by creating a new StateSelectionList object and adding it the stage using the following code:
    var states:StateSelectionList = new StateSelectionList();
    addChild(states);
    The data provider for the new object is empty, however, as one can find by tracing the length of the object's dataProvider property;
    trace(states.dataProvider.length);
    I am new to creating external class files so I am not sure why the new object is not populated with any data. Thanks in advance for any suggestions.
    P.S. Please feel free to download the complete XML file I created for the states. The file includes all US states and possessions, US military states, and Canadian provinces and territories. http://windhorsemedia.com/private/states.xml

    There is a something tricky:
    first if you extend the combo box ther is no need to create a new instance in its constructor only to pass the data provider. This will work
        var xml:XML =<states>
                <state name="AL - ALABAMA" value="AL" />
                <state name="AK - ALASKA" value="AK" />
                <state name="AZ - ARIZONA" value='AZ' />
                </states>;
                dataProvider=new DataProvider(xml);
    dataProvider is public from base class ComboBox so you can access it anytime. But the properties that are inspactable may be setted with effect only after second frame is passed so try this
    public class StateSelectionList extends ComboBox {
            public function StateSelectionList():void
              addEventListener( Event>ENTER_FRAME, onsecondFrame, false, 0, true )
    private function onsecondFrame( evnt : Event ): void
    removeEventListener( Event>ENTER_FRAME, onsecondFrame
                var xml:XML =<states>
                <state name="AL - ALABAMA" value="AL" />
                <state name="AK - ALASKA" value="AK" />
                <state name="AZ - ARIZONA" value='AZ' />
                </states>;
                dataProvider=new DataProvider(xml);
                labelField="name";
    Note, In my custom components when I extend the UIComponent a set the parameter in afterComponentParameters or CreateUI( I think this was the name ) methods but more fast is just to pass one frame and set the parameturs

  • How to use Parameter from file in window env

    hi All,
    Please tell me the how I can get Parameter from Saved file and can use in other file.
    EX:
    I want to use Password file for each instance like
    ORCL-manager
    ORCL_1-tiger
    ORCL_2-*****
    how to call this file in other file. using pasword for instance
    any help would be appereciated.
    Regards,

    You can use SFTP for this.
    This is a way of implementing SFTP in SSIS using standard tasks 
    http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html
    also see
    http://blog.goanywheremft.com/2011/10/20/sftp-ftps-secure-ftp-transfers/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Use method from father class for event

    Hi,
    I want to use a preDelete event in my class, but the method I would like to call for the event is not in the class itself, but in the (abstract) predecessor class. Any chance to do this? At the moment I can't select the method in the event tab page (it's not in the list to choose from ...)
    Thank you!
    J.F.

    In 9.0.4 you will need to add the parent class as a descriptor and choose to deactivate it. This will allow you to choose methods from that class in the subclass descriptors.
    In 10.1.3 there is a dialog for specifying classes that are not persistent, but necessary in other persistent classes: http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/mw007.htm#sthref629
    A good explanation of why we don't store the parent and referenced classes unless explictly asked can be found here: Re: Mapping Workbench  10.1.3.0 Bug - Cannot add Implemented Interfaces
    Hope this helps,
    Karen

  • Setting up position of front panel objects using input from file

    I am working on a project and i have got the following query.
    i have a front panel with lot of objects like knobs,dials,push buttons etc..
    the entire panel will be the console to the user and as he changes the various
    positions of the objects their values will be written in to a file.
    now after a days work when the system is restarted again the next day
    the values of various objects should be read from the file and the front panel objects should be set in their position according to it
    in short the objects(knobs,buttons etc) should both act as o/p i.e when user interacts with them and they should also act as i/p when their position will be set from
    file.
    how can i achieve this.any help regard
    ing this would be greatly appreciated

    You should separate the read portion of this vi from the write portion of the vi. You want to execute the read portion of the vi only at startup and the write portion of the vi only at shutdown. So you'll be reading the file and writing the output to the property nodes, running your program, and then taking the value of the controls and writing to file. I have attached an example of how this might work. You might also do this with a state machine structure to control the data flow.
    Hope that helps
    Attachments:
    query.vi ‏49 KB
    read_file.vi ‏42 KB
    write_file.vi ‏36 KB

  • Use field from file header record in detail records

    Hi,
    I receive a file with different records type (transmission header, file header, detail records, file footer). The fields in each record type are different. The transmission header tells me who the sender of the file is. I need this information, because I am merging data of various senders into one table.
    When processing the files, I need to split each file according to recordtype. (I can not use the same logic for each recordtype). How can I populate an extra column in the detail files with the value from the header record?
    What I tried so far is the following:
    - Populate a global variable using a script: This does not seem to work in the context of dataflows.
    - Create a 'join' between header record and detail record. However there are no fields I can join, so Data Services is not happy with that.
    - Store the field value from the header record in a DS (I chose a cache datastore, memory datastore did not work in batch scenario. I feel I can get this to work, but it seems quite an elaborate and expensive solution: First Filter the header record from the file, write the required field to the cache datastore, then read the same file but now filter the detail records, and join this with the datastore.
    Is there a better way to do this? I was hoping I could just use a script and read the first line of my file and move the value to a global variable....
    It would be great if someone could give me some tips...
    Many thanks,
    Jan.

    Hi Werner,
    I am not sure if I understand you correctly.
    I have declared $State as a global variable, not as a parameter.
    When I check my custom function I do get a warning that a variable is called which is not declared.
    I thought I did not have to worry about this as the variable does exist within the job where the function is called.
    It looks like I can not set a value to a global variable in a custom function.
    Is that correct, or is there something wrong with my syntax?
    Really the only reason I call a custom function is to set the global variable, so I could even make my function as simple as this:
    $State = 'NSW';
    Return 0;
    It still doesn't work...
    Any idea why?
    Thanks,
    Jan.

  • Use Existing Song Files on Mobile Devices

    I have always been very frustrated with the fact that if I want to listen to a song or use it in a playlist (offline) within the Spotify app, I cannot do so with a song that is already on my device.
    Example:
    I use the Spotify app on my iPhone for most of my music listening. However, I have a handful of other apps that allow me to listen to my local music through them (like a game or workout app for example), but all these other apps can only see songs on my iPhone that were synced via iTunes. Say I want to listen to a certain playlist or album during my workout using my workout app, but I also want to listen to those same songs later in the Spotify app (offline, to save on data streaming). This would require me to have TWO copies of each song on my device (Which is rediculous! Who has the extra space for that?), one in the native music player library, and one synced using Spotify.
    PLEASE find a way for the Spotify app to recognize the existing songs on a mobile device without having to sync them using desktop Spotify. No one should have to have duplicates of local songs on their device. Compatibility with the local native music on a device would be a godsend!

    I joined this community just so I could recommend this feature. I hope the people at Spotify do not find this trivial due to the ability to add local files via syncing with the desktop app, we all know this. MANY of us, including myself, don't have/use desktops anymore. I have no way of adding my music to My Music, I have to use two separate apps for music which is extremely inconvenient. The worst part is how easy this would be to implement, especially with the dev tools released with iOS 8; There is no reason Spotify shouldn't play well with the rest of iOS apps, environment, and local files. This (besides Apples reluctance to allow Spotify to be the default music app, and Siri integration, which tbf is Apple problem) is the the only thing keeping Spotify from being near darn perfect. Please fix this soon!!

  • Cannot download iTunes 7 and trouble with existing iTunes file

    I downloaded iTunes onto my hard drive on my computer but also onto an external hard drive as well. Everything worked fine until I went to open iTunes on my desktop one day and an error window popped up.
    "Windows - No Disk
    Exception Processing Message c0000013 Parameters 75b6bf9c 4 75b6bf9c 75b6bf9c"
    With buttons Cancel, Try Again & Continue.
    If I close the warning windows (2 always pop up) I get an iTunes Setup Assistant window.
    "Warning!
    iTunes was not properly installed. If you want iTunes to be able to retrieve CD information from the internet, you need to reinstall iTunes."
    When I press the "Okay" button on that window, iTunes opens without a problem and with all the music in my iTunes library. I've been able to use it just fine with my iPod and on the iTunes store.
    However, I have attempted to download iTunes 7 and it has not let me. I have successfully downloaded the iTunes 7 Set-up file. When I go to run the file, it wants to put the iTunes in my J: drive. The J: drive isn't on my computer though because it says it has 0KB space available on the drive. When I try and change the destination of iTunes it says "The volume J: is currently unavailable. Please select another." It won't let me select another and then immediatly takes me to the last page of the installer where it says:
    "The installer encountered errors before it could be completed..."
    Enpower (?) Desktop   Windows XP  
    Enpower (?) Desktop   Windows XP  
    Enpower (?) Desktop   Windows XP  

    okay. i've seen four or five of these lately. it
    seems to be associated with something to do with
    external drives and/or drive letter assignments, and
    can hit other programs than itunes (according to a
    thread i found at the Microsoft Newsgroups).
    here's a search on the error code here at
    Discussions:
    c0000013
    ... are any of the links in the various threads there
    of any assistance with your manifestation of this?
    Make that six. I am now receiving the exact same error message. My message makes iTunes completely inoperable and there is no way for me to get around it. Yes, I too have external drives attached to my computer. Anyone have advice on how to deal with this exception errort? I hope Apple has fix for us soon.
    Thanks in advance for any help!

  • Having trouble using ExportPDf message file failed to be converted using Adobe ExportPDF online

    need help
    file failed to be converted using Adobe ExportPDF online

    Hi PeterChick,
    Does it occur with all files or a specific file?
    Are you trying to convert from within Reader or from Browser?
    If from Reader then make sure you are signed in within Reader, also try updating Reader to the latest v11.0.09 and check.
    If from Browser then have you checked with a different browser if possible?
    Regards,
    Florence

  • How to use existing WSP file of reusable workflow and create sanbox solution?

    Hello,
    I have to migrate the SharePoint Designer 2013 workflows from Development environment to Production environment. So, I am following the process which is mentioned in this blog:
    http://sharepointyankee.com/2010/12/11/options-for-deploying-reusable-workflows-in-sharepoint-2010/
    And it is working also, but problem is that; this visual studio solution is getting deployed as a Farm Solution and I wanted to deploy it as a sandbox solution. 
    Is there any way to achieve this?
    I have also tried one more way which is:
    Create SharePoint Custom Workflow Project as a sandbox solution in Visual studio.
    Get WSP file from development site (as mentioned in above referenced blog)
    Open WSP file and copy the content to Visual Studio Created project
    But this solution is also not working; "Feature is not getting deployed as sandbox solution" error is occurring.
    Can anyone please help me on the same?
    Thanks,
    Asim

    Hi,
    When you export SPD workflow, it will be a sandbox solution only, you are not required to configure further.
    Just import the workflow into Visual Studio, and make the changes that are required. you are good here.
    you can set the scope attribute in your WSP feature element.
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • Trouble using Migration from iMac to new i5 iMac

    I just purchased the new i5 iMac. I want to use the migration software to transfer my files, programs etc. to my new machine. Everything goes as directed until the i5 reads my old iMac and then give me this error:
    "There are no versions of Mac OS X available on your old Mac."
    What does this mean. My old mac is running OS X 10.4.11. Will I still be able to migrate all my information?

    Problem solved! I don't know what the problem was. Probably the order I was turning on the computers. They were recognizing each other but I was getting the error message on the new computer. I shut everything down and the started over and everything clicked!
    Thanks for the help! I will look out for Rosetta and will definetly repair permissions as soon as the updates are done.
    I love this site! Better than any tech department around!

  • Using HashMaps from another class

    I'm trying to use a HashMap to store a person with a given Id. When i create a HashMap as part of a main method and use the put method on that HashMap everything goes fine ie:
    Map myMap = new HashMap();
    Person james = new Person)("James", "Smith");
    myMap.put(1,james);However, when I use a HashMap as part of one class and attempt to call it in another using a simple add method I get a null pointer exception. For example, I have the class People which is basically:
    import java.util.*;
    public class People
        private Map myPeople;
        public People()
            Map myPeople = new HashMap();
        public void addPerson(int id, Person p)
            PeopleTable.put(id,p);
    }I then make a call to this using a separate main method
    Person james = new Person ("James","Smith");
    People myFamily = new myFamily();
    myFamily.addPerson(1,james);but get a null pointer exception. I can't see anything glaringly obvious that i'm getting wrong, but i've just started using HashMaps so I may be missing something.
    Any insight would be greatly appreciated!
    Thanks,
    Nick

    nickd_101 wrote:
    However, when I use a HashMap as part of one class and attempt to call it in another using a simple add method I get a null pointer exception. For example, I have the class People which is basically:
    import java.util.*;
    public class People
    private Map myPeople;
    public People()
    Map myPeople = new HashMap(); //*** You're declaring the map again here, don't do this.
    public void addPerson(int id, Person p)
    PeopleTable.put(id,p);
    You're declaring the map twice, once at the top of the class, which is good, and once again in the constructor, which is very bad since the class's hashmap never gets constructed. Don't do this.
    The constructor should be:
        public People()
            myPeople = new HashMap(); // ** better
        }

Maybe you are looking for

  • My iMac hangs when installing Yosemite.

    My iMac hangs when "installing on HD about 22 mins remaining" I did not check to see if this iMac can support Yosemite. What do I do now?

  • Index File in Acrobat 8 Standard

    Adobe Version 5 / Adobe Version 8 Standard In Adobe Version 5 is a facility called Catalog which creates an index.pdx file which significantly speeds up the Search function when searching across a collection of documents. Does Version 8 Standard have

  • Exporting Numbers file with leading zeros as csv file

    When I export a list of mobile phone numbers with leading zeros (086* etc.) from Numbers as a csv file, the leading zeros are stripped out, although the cells are previously formatted as text. What can I do about this?

  • Help: Clear Function for JSF

    Hi Experts, I have a page with several jsf textfields in which the first half is being populated by my first bean and the other is being populated by my second bean. I would like to know on how anyone of you would go about clearing all the textfields

  • IMAC G5 shuts off by itself without showing any errors

    My Imac G5 will shut off when it is left in the sleep mode for 2 or more hours. The system will come back on when turned back on and does not show any errors. Everything seems to be running great except for the fact it shuts off by itself. Please Hel