Need help !! Adding search capability to JText component.

We need help adding the string search capability to the JText component like how other text editors have. Does anybody know what component to use and what the easiest way to implement it is?

Swing components are implemented using a design pattern called MVC - Model View Controller. The View is simply the visual representation of the Model, where all the good stuff is stored, namely the state of the component. (And the Controller glues everyhing together.)
The JTextComponent uses a javax.swing.text.Document as its model. What you can do is get access to your component's model, and from that get access to the text contained in the Document. Once you have that text, the easiest thing you can do is do an indexOf() search.

Similar Messages

  • I need help adding a mouse motion listner to my game. PLEASE i need it for

    I need help adding a mouse motion listner to my game. PLEASE i need it for a grade.
    i have a basic game that shoots target how can use the motion listner so that paint objects (the aim) move with the mouse.
    i am able to shoot targets but it jus clicks to them ive been using this:
    public void mouse() {
    dotX = mouseX;
    dotY = mouseY;
    int d = Math.abs(dotX - (targetX + 60/2)) + Math.abs(dotY - (targetY + 60/2));
    if(d < 15) {
    score++;
    s1 = "" + score;
    else {
    score--;
    s1 = "" + score;
    and here's my cross hairs used for aiming
    //lines
    page.setStroke(new BasicStroke(1));
    page.setColor(Color.green);
    page.drawLine(dotX-10,dotY,dotX+10,dotY);
    page.drawLine(dotX,dotY-10,dotX,dotY+10);
    //cricle
    page.setColor(new Color(0,168,0,100));
    page.fillOval(dotX-10,dotY-10,20,20);
    please can some1 help me

    please can some1 help meNot when you triple post a question:
    http://forum.java.sun.com/thread.jspa?threadID=5244281
    http://forum.java.sun.com/thread.jspa?threadID=5244277

  • Need help adding schedule to xcode 4

    I need help adding a tour schedule for an iphone app building an app for 13 djs and they want thier tour schedules added these need to be updated monthly is there a way to add this????

    I don't know if this is the easiest way but it works for me. I connect the DVD player to my camcorder (so it's the 3 plugs yellow/red/white on one end and a single jack into the camera). Then I connect my camcorder to the computer (I think it's through a firewire port). Then I just play the DVD and the footage is digitized via the camcorder and I import it into iMovie 4 as it's playing. I believe the camcorder is just in VCR mode.
    I have also used this method to transfer VHS tapes onto DVDs via the camera by connecting the VCR to the camera.
    I haven't had much luck with movies over about 40 minutes on iMovie. But if it's home movies, there may be a logical break. Do maybe 20 minute segments (it's also really easy on iMovie to add a soundtrack if these are OLD films with no sound.
    As you can see, I'm low tech!
    Good luck!
    Powerbook G4   Mac OS X (10.3.9)  

  • Need help adding Arch to Grub

    I am trying to dual boot Arch Linux and Ubuntu. When I try to boot there is no option for Arch. I have added it to the menu.lst file in ubuntu. Arch is installed on sdb1 according to sudo fdisk -l  I need help!

    Fdisk -l
    Disk /dev/sda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xb38ab38a
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1        9544    76662148+  83  Linux
    /dev/sda2            9545        9729     1486012+   5  Extended
    /dev/sda5            9545        9729     1485981   82  Linux swap / Solaris
    Disk /dev/sdb: 40.9 GB, 40992473088 bytes
    255 heads, 63 sectors/track, 4983 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x0002eb1f
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           1        4891    39286926   83  Linux
    Disk /dev/sdc: 250.0 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x000ea9be
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1               1       30401   244196001    7  HPFS/NTFS
    I think Arch is on the 40GB partition
    Menu.lst
    # menu.lst - See: grub(8), info grub, update-grub(8)
    #            grub-install(8), grub-floppy(8),
    #            grub-md5-crypt, /usr/share/doc/grub
    #            and /usr/share/doc/grub-doc/.
    ## default num
    # Set the default entry to the entry number NUM. Numbering starts from 0, and
    # the entry number 0 is the default if the command is not used.
    # You can specify 'saved' instead of a number. In this case, the default entry
    # is the entry saved with the command 'savedefault'.
    # WARNING: If you are using dmraid do not use 'savedefault' or your
    # array will desync and will not let you boot your system.
    default        0
    ## timeout sec
    # Set a timeout, in SEC seconds, before automatically booting the default entry
    # (normally the first entry defined).
    timeout        0
    ## hiddenmenu
    # Hides the menu by default (press ESC to see the menu)
    hiddenmenu
    # Pretty colours
    #color cyan/blue white/blue
    ## password ['--md5'] passwd
    # If used in the first section of a menu file, disable all interactive editing
    # control (menu entry editor and command-line)  and entries protected by the
    # command 'lock'
    # e.g. password topsecret
    ## password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
    # password topsecret
    # examples
    # title        Windows 95/98/NT/2000
    # root        (hd0,0)
    # makeactive
    # chainloader    +1
    # title        Linux
    # root        (hd0,1)
    # kernel    /vmlinuz root=/dev/hda2 ro
    # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
    ### BEGIN AUTOMAGIC KERNELS LIST
    ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
    ## by the debian update-grub script except for the default options below
    ## DO NOT UNCOMMENT THEM, Just edit them to your needs
    ## ## Start Default Options ##
    ## default kernel options
    ## default kernel options for automagic boot options
    ## If you want special options for specific kernels use kopt_x_y_z
    ## where x.y.z is kernel version. Minor versions can be omitted.
    ## e.g. kopt=root=/dev/hda1 ro
    ##      kopt_2_6_8=root=/dev/hdc1 ro
    ##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
    # kopt=root=UUID=ce3a864f-3f72-480b-96b3-54516b307170 ro
    ## default grub root device
    ## e.g. groot=(hd0,0)
    # groot=ce3a864f-3f72-480b-96b3-54516b307170
    ## should update-grub create alternative automagic boot options
    ## e.g. alternative=true
    ##      alternative=false
    # alternative=true
    ## should update-grub lock alternative automagic boot options
    ## e.g. lockalternative=true
    ##      lockalternative=false
    # lockalternative=false
    ## additional options to use with the default boot option, but not with the
    ## alternatives
    ## e.g. defoptions=vga=791 resume=/dev/hda5
    # defoptions=quiet splash
    ## should update-grub lock old automagic boot options
    ## e.g. lockold=false
    ##      lockold=true
    # lockold=false
    ## Xen hypervisor options to use with the default Xen boot option
    # xenhopt=
    ## Xen Linux kernel options to use with the default Xen boot option
    # xenkopt=console=tty0
    ## altoption boot targets option
    ## multiple altoptions lines are allowed
    ## e.g. altoptions=(extra menu suffix) extra boot options
    ##      altoptions=(recovery) single
    # altoptions=(recovery mode) single
    ## controls how many kernels should be put into the menu.lst
    ## only counts the first occurence of a kernel, not the
    ## alternative kernel options
    ## e.g. howmany=all
    ##      howmany=7
    # howmany=all
    ## specify if running in Xen domU or have grub detect automatically
    ## update-grub will ignore non-xen kernels when running in domU and vice versa
    ## e.g. indomU=detect
    ##      indomU=true
    ##      indomU=false
    # indomU=detect
    ## should update-grub create memtest86 boot option
    ## e.g. memtest86=true
    ##      memtest86=false
    # memtest86=true
    ## should update-grub adjust the value of the default booted system
    ## can be true or false
    # updatedefaultentry=false
    ## should update-grub add savedefault to the default options
    ## can be true or false
    # savedefault=false
    ## ## End Default Options ##
    title        Ubuntu 9.04
    uuid        ce3a864f-3f72-480b-96b3-54516b307170
    kernel        /boot/vmlinuz-2.6.28-11-generic root=UUID=ce3a864f-3f72-480b-96b3-54516b307170 ro quiet splash
    initrd        /boot/initrd.img-2.6.28-11-generic
    quiet
    #title        Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
    #uuid        ce3a864f-3f72-480b-96b3-54516b307170
    #kernel        /boot/vmlinuz-2.6.28-11-generic root=UUID=ce3a864f-3f72-480b-96b3-54516b307170 ro  single
    #initrd        /boot/initrd.img-2.6.28-11-generic
    #title        Ubuntu 9.04, memtest86+
    #uuid        ce3a864f-3f72-480b-96b3-54516b307170
    #kernel        /boot/memtest86+.bin
    #quiet
    # (0) Arch Linux
    title  Arch Linux 
    root   (hd1,0)
    kernel /vmlinuz26 root=/dev/sda3 ro
    initrd /kernel26.img
    ### END DEBIAN AUTOMAGIC KERNELS LIST
    title Arch
    rootnoverify (hd0,1)
    chainloader +1

  • ComboBox (dropdown) Need Help Adding URL links!!!

    I am somewhat of a newbie....Anybody know how to use URL
    links in a ComboBox dropdown menu? NEED HELP!!!!!!! I'm trying to
    make it so that after selecting an option, the user is directed to
    another URL within the same browser window. Using flash 8!
    Thanks,

    Im a bit a newbie myslef but i think you make flash
    commuincate to javascript wich will make the browser goto the URL.
    do a search on getURL and javascript together and i am sure
    you will find something.
    And when slecting to redirct i think its on?(onPress)
    something so maybe look throught the help section in flash 8 and
    look at componets. I think there is some actionscript help there.
    Sorry i could not be more helpful.

  • I have a godaddy website with a welcome page- I need help adding a few additional pages with a hyperlink to my welcome page.

    I need help attaching a few hyperlinks my godaddy welcome page. I have 2 more ipages articles, I also converted them to pdf. Godaddy only helped (last year) with the 1st article.  I do not know how to attach a hyperlink to the artlcles and add the hyperlinks to my welcome page.

    The program is called Pages not iPages. Just let us know if you do not speak English and what language you do speak so we can adjust for that.
    The issues are to do with your web page not with Pages.
    I think you are asking how to link from your web page to your pdf articles. You must first copy those pdfs to your web server, or some other web location, and then provide html links on your welcome page to those pdf files.
    The pdfs themselves may contain links to other locations but I can not see that that is what you are asking for.
    Nor to what those links would be to.
    From your heading I think you may have confused the name of Pages, the word processing program, with web pages which are two different things.
    Peter

  • Need help adding video to a site

    Hi Everyone:
    I really need some help please. The owner of a site I am
    working on sent me a DVD with video's he has taken and wants them
    put on his site.
    The files are VIDEO_TS and are MPEG files. How can I add the
    video's to the site so that when I user clicks on the link, they
    are able to either view the site or download the video to watch
    later. I have other video's added to the site but I was able to
    copy them and safe them the way there were added. The owner sells
    products from the site I copied them from.
    The site I am working on is www.buggyworld.net. Most of the
    individual pages for the vehilces have videos on them and I am
    trying to add these new ones the same way. I have never done this
    before so really not sure how to. The videos that are already added
    at Windows Media Audio/Video Files and that is how I would like to
    convert this video to.
    Any help would be so greatly appreciated.. thank you
    Linda

    Best bet would be to make Flash video so that everyone who
    wants to (and has
    the Flash Player plugin) can see them. Do you have Flash?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Frank Branker" <[email protected]> wrote in
    message
    news:f4ph73$rcd$[email protected]..
    > What?s the size of your MPG file?
    >
    > It?s better if you convert your file to a wmv file
    format because it?s
    > important to keep your file size under 6 Megs. Do you
    have the software to
    > do
    > this?
    > Windows Movie maker might be able to do this you can
    find it in your
    > program
    > files on your computer.
    >
    > If not we will have to work with what you have and do a
    quick and dirty
    > but I
    > don?t advise that.
    >
    > Below is a list of tools you may want to consider
    owning.
    >
    > Ripping Software
    > This software will rip from a dvd to just about any
    format including WMV
    >
    http://www.imtoo.com/dvd-ripper.html
    >
    > Compressing software
    > Sorenson Squeeze Suite 4.5 is the industry-leading video
    encoding tool
    >
    http://www.sorensonmedia.com/pages/?pageID=2
    >
    >
    >

  • Need help with search function in my program

    Hello all, some of you may remeber me from my previous inventory programs. Well I am finally on my last one and I need to add a search option to the code. Here is the class that will contain that option.
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Inventory2 extends JFrame implements ActionListener {
    //Utility class for displaying the picture
    //If we are going to use a class/method/variable inside that class only, we declare it private in that class
    private class MyPanel extends JPanel {
    ImageIcon image = new ImageIcon("Sample.jpg");
    int width = image.getIconWidth();
    int height = image.getIconHeight();
    long angle = 30;
    public MyPanel(){
    super();
    public void paintComponent(Graphics g){
         super.paintComponent(g);
         Graphics2D g2d = (Graphics2D)g;
         g2d.rotate (Math.toRadians(angle), 60+width/2, 60+height/2);
         g2d.drawImage(image.getImage(), 60, 60, this);
         g2d.dispose();
    }//end class MyPanel
    int currentIndex; //Currently displayed Item
    Product[] supplies = new Product[4];
    JLabel name ;
    JLabel number;
    JLabel rating;
    JLabel quantity;
    JLabel price;
    JLabel fee;
    JLabel totalValue;
    JTextField nameField = new JTextField(20);
    JTextField numberField = new JTextField(20);
    JTextField ratingField = new JTextField(20);
    JTextField quantityField = new JTextField(20);
    JTextField priceField = new JTextField(20);
    JPanel display;
    JPanel displayHolder;
    JPanel panel;
    boolean locked = false; //Notice how I've used this flag to keep the interface clean
    public Inventory2() {
    makeTheDataItems();
    setSize(700, 500);
    setTitle("Inventory Program");
    //make the panels
    display = new JPanel();
    JPanel other = new JPanel();
    other.setLayout(new GridLayout(2, 1));
    JPanel picture = new MyPanel();
    JPanel buttons = new JPanel();
    JPanel centerPanel = new JPanel();
    displayHolder = new JPanel();
    display.setLayout(new GridLayout(7, 1));
    //other.setLayout(new GridLayout(1, 1));
    //make the labels
    name = new     JLabel("Name :");
    number = new JLabel("Number :");
    rating = new JLabel("Rating     :");
    quantity = new JLabel("Quantity :");
    price = new JLabel("Price     :");
    fee = new JLabel("Restocking Fee (5%) :");
    totalValue = new JLabel("Total Value :");
    //Use the utility method to make the buttons
    JButton first = makeButton("First");
    JButton next = makeButton("Next");
    JButton previous = makeButton("Previous");
    JButton last = makeButton("Last");
    JButton search = makeButton("Search");
    //Other buttons
    JButton add = makeButton("Add");
    JButton modify = makeButton("Modify");
    JButton delete = makeButton("Delete");
    JButton save = makeButton("Save");
    JButton exit = makeButton("Exit");
    //Add the labels to the display panel
    display.add(name);
    display.add(number);
    display.add(rating);
    display.add(quantity);
    display.add(price);
    display.add(fee);
    //add the buttons to the buttonPanel
    buttons.add(first);
    buttons.add(previous);
    buttons.add(next);
    buttons.add(last);
    buttons.add(search);
    //Add the picture panel and display to the centerPanel
    displayHolder.add(display);
    centerPanel.setLayout(new GridLayout(2, 1));
    centerPanel.add(picture);
    centerPanel.add(displayHolder);
    other.add(buttons);
    JPanel forAdd = new JPanel(); // add the other buttons to this panel
    forAdd.add(add);
    forAdd.add(modify);
    forAdd.add(delete);
    forAdd.add(save);
    forAdd.add(exit);
    other.add(forAdd);
    //Add the panels to the frame
    getContentPane().add(centerPanel, "Center");
    getContentPane().add(other, "South");
    this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setVisible(true);
    private void makeTheDataItems () {
    Product p1 = new DVD("The one", 001, 200, 100, "The one");
    Product p2 = new DVD("Once upon a time in China V", 002, 500, 10000, "Once upon a time in China V");
    Product p3 = new DVD("Rat Race", 003, 100, 3000, "Rat Race");
    Product p4 = new DVD("The Man in the Iron Mask", 004, 3000, 9000, "The Man in the Iron Mask");
    supplies[0] = p1;
    supplies[1] = p2;
    supplies[2] = p3;
    supplies[3] = p4;
    //Utility method for creating and dressing buttons
    private JButton makeButton(String label) {
    JButton button = new JButton(label);
    button.setPreferredSize(new Dimension(100, 25));
    button.setActionCommand(label);
    button.addActionListener(this);
    return button;
    private void addItem() {
    panel = new JPanel();
    JPanel add = new JPanel();
    add.setLayout(new GridLayout(7, 2));
    JButton addIt = makeButton("Add Item");
    JLabel name = new JLabel("Name :");
    JLabel rating = new JLabel("Rating     :");
    JLabel quantity = new JLabel("Quantity :");
    JLabel price = new JLabel("Price     :");
    add.add(name); add.add(nameField);
    add.add(rating); add.add(ratingField);
    add.add(quantity); add.add(quantityField);
    add.add(price); add.add(priceField);
    panel.add(add);
    JPanel forAddIt = new JPanel();
    forAddIt.add(addIt);
    panel.add(forAddIt);
    displayHolder.remove(display);
    displayHolder.add(panel);
    //display = panel;
    this.setVisible(true);
    public static void main( String args[]) {
    new Inventory2().displayFirst(); //The main method should not have too much code
    } // end main method
    public void actionPerformed(ActionEvent event) {
      String command = event.getActionCommand(); //This retrieves the command that we set for the button
      //Always compare strings using the .equals method and not using ==
      if(command.equals("First")) {
       if(!locked) {
         displayFirst();
      else if(command.equals("Next")) {
       if(!locked) {
         displayNext();
      else if(command.equals("Previous")) {
       if(!locked) {
         displayPrevious();
      else if(command.equals("Last")) {
       if(!locked) {
         displayLast();
      else if(command.equals("Exit")) {
       this.dispose();
       System.exit(0);
      else if(command.equals("Add")) {
       if(!locked) {
         addItem();
         locked = true;
      else if(command.equals("Add Item")) {
       addItemToArray();
      else if(command.equals("Modify")) {
       if(!locked) {
         modify();
         locked = true;
      else if(command.equals("Update")) {
          if(!locked) {
         modifyItemInArray();
         locked = true;
      else if(command.equals("Delete")) {
       if(!locked) {
         DVD dvd = (DVD)supplies[currentIndex];
            int confirm = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete item "+dvd.getItemNumber());
                if(confirm == JOptionPane.YES_OPTION) {
          removeItemAt(currentIndex);
          displayFirst();
    private void modify() {
    DVD dvd = (DVD)supplies[currentIndex];
    panel = new JPanel();
    JPanel add = new JPanel();
    add.setLayout(new GridLayout(7, 2));
    JButton update = makeButton("Update");
    JLabel number = new JLabel("Number :");
    JLabel name = new JLabel("Name :");
    JLabel rating = new JLabel("Rating     :");
    JLabel quantity = new JLabel("Quantity :");
    JLabel price = new JLabel("Price     :");
    add.add(number);
    numberField.setText(""+dvd.getItemNumber()); numberField.setEditable(false); add.add(numberField);
    add.add(name);
    nameField.setText(dvd.getItemName()); add.add(nameField);
    ratingField.setText(dvd.getRating()); ratingField.setEditable(false);
    add.add(rating); add.add(ratingField);
    add.add(quantity);
    quantityField.setText(""+dvd.getStockQuantity());
    add.add(quantityField);
    add.add(price);
    add.add(priceField); priceField.setText(""+dvd.getItemPrice());
    panel.add(add);
    JPanel forAddIt = new JPanel();
    forAddIt.add(update);
    panel.add(forAddIt);
    displayHolder.remove(display);
    displayHolder.add(panel);
    //display = panel;
          this.setVisible(true);
    private void addItemToArray() {
    Product p = new DVD(nameField.getText(), supplies.length + 1, Long.parseLong(quantityField.getText()),
    Double.parseDouble(priceField.getText()), ratingField.getText());
    //Extend size of array by one first
    Product[] ps = new Product[supplies.length + 1];
    for(int i = 0; i < ps.length-1; i++) {
    ps[i] = supplies;
    ps[supplies.length] = p;
    supplies = ps;
    displayHolder.remove(panel);
    displayHolder.add(display);
    displayLast();
    this.setVisible(false);
    this.setVisible(true);
    //Utility method to ease the typing and reuse code
    //This method reduces the number of lines of our code
    private void displayItemAt(int index) {
    DVD product = (DVD)supplies[index];
    name.setText("Item Name: "+ product.getItemName());
    number.setText("Item Number: "+ product.getItemNumber());
    rating.setText("Rating: "+ product.getRating());
    quantity.setText("Quantity In Stock: "+ product.getStockQuantity());
    price.setText("Item Price: "+ product.getItemPrice());
    totalValue.setText("Total: " + product.calculateInventoryValue());
    fee.setText("Restocking Fee (5%) :"+product.calculateRestockFee());
    locked = false;
    this.repaint();
    this.setVisible(true);
    private void modifyItemInArray() {
    Product p = new DVD(nameField.getText(), supplies.length + 1, Long.parseLong(quantityField.getText()),
    Double.parseDouble(priceField.getText()), ratingField.getText());
    supplies[currentIndex] = p;
    displayHolder.remove(panel);
    displayHolder.add(display);
         displayItemAt(currentIndex);
    this.setVisible(false);
    this.setVisible(true);
    private void removeItemAt(int index) {
    Product[] temp = new Product[supplies.length-1];
    int counter = 0;
    for(int i = 0; i < supplies.length;i++) {
    if(i == index) { //skip the item to delete
    else {
         temp[counter++] = supplies[i];
    supplies = temp;
    public void displayFirst() {
    displayItemAt(0);
    currentIndex = 0;
    public void displayNext() {
    if(currentIndex == supplies.length-1) {
    displayFirst();
    currentIndex = 0;
    else {
    displayItemAt(currentIndex + 1);
    currentIndex++;
    public void displayPrevious() {
    if(currentIndex == 0) {
    displayLast();
    currentIndex = supplies.length-1;
    else {
    displayItemAt(currentIndex - 1);
    currentIndex--;
    public void displayLast() {
    displayItemAt(supplies.length-1);
    currentIndex = supplies.length-1;
    }//end class Inventory2
    I am not sure where to put it and how to set it up. If you guys need the other two classes let me know. Thanks in advanced.

    Here are the other two classes:
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class Product implements Comparable {
    String name;
    int number;
    long stockQuantity;
    double price;
    public Product() {
      name = "";
          number = 0;
          stockQuantity = 0L;
          price = 0.0;
    public Product(String name, int number, long stockQuantity, double price) {
      this.name = name;
          this.number = number;
          this.stockQuantity = stockQuantity;
          this.price = price;
         public void setItemName(String name) {
      this.name = name;
    public String getItemName() {
      return name;
    public void setItemNumber(int number) {
      this.number = number;
    public int getItemNumber() {
      return number;
    public void setStockQuantity(long quantity) {
      stockQuantity = quantity;
    public long getStockQuantity() {
      return stockQuantity;
    public void setItemPrice(double price) {
      this.price = price;
    public double getItemPrice() {
      return price;
    public double calculateInventoryValue() {
      return getItemPrice() * getStockQuantity();
    public int compareTo (Object o) {
      Product p = (Product)o;
      return name.compareTo(p.getItemName());
    public String toString() {
      return "Name :"+getItemName() + "\nNumber"+number+"\nPrice"+price+"\nQuantity"+stockQuantity + "\nValue :"+calculateInventoryValue();
    class DVD extends Product implements Comparable {
    private String rating;
    public DVD() {
      super(); //Call the constructor in Product
      rating = ""; //Add the additonal attribute
    public DVD(String name, int number, long stockQuantity, double price, String rating) {
      super(name, number, stockQuantity, price); //Call the constructor in Product
      this.rating = rating; //Add the additonal attribute
         public void setRating(String rating) {
      this.rating = rating;
    public String getRating() {
      return rating;
    public double calculateInventoryValue() {
      return getItemPrice() * getStockQuantity() + getItemPrice()*getStockQuantity()*0.05;
    public double calculateRestockFee() {
      return getItemPrice() * 0.05;
    public int compareTo (Object o) {
      Product p = (Product)o;
      return getItemName().compareTo(p.getItemName());
    public String toString() {
      return "Name :"+getItemName() + "\nNumber"+getItemNumber()+"\nPrice"+getItemPrice()+"\nQuantity"+getStockQuantity() +"\nRating :"+getRating()+"\nValue"+calculateInventoryValue();
    }You should be able to search through these items, and any other items that have been added to the program.

  • Need help adding image to datagrid column

    Hi,
    Can anyone tell me how to add an image to a datagrid column?
    I have created a flex library project which contains a mxml component with a datagrid, an item renderer mxml component which rendered the image within the datagrid column depending on the value coming back from the database for that column and a folder 'assets' which hold all the images. When I add the library to my main project and call the mxml component with the datagrid an image place holder is visible in the datagrid column but not the image. However, if I take the image out of the library project and added to an 'assets' folder in the main project the image is displayed in the datagrid column.
    It looks like, even though the images are in the flex library project and only the flex library project is trying to display the images in the datagrid, the library project is looking in the main application project folder for the image.
    Does anyone know why this is happening and how to fix it?
    Thanks in advance for an help,
    Xander.

    I have tried embedding the images in my library but it still didn't work. Also I can't embed the image as I'm using the value of the column to complete the image name, for example in my mxml item renderer component I have the added the following code
    <mx:Image source="@Embed(source='assets/' + data.mycolumnvalue + '.png')" tooltip="{data.mycolumnvalue}"/>
    but nothing is displayed.

  • Need help adding AM/PM to my clock program

    Hi everyone
    I would be grateful if you could help me adding AM/PM to my clockDisplay program, been trying but i'm not very familiar with Java.
    Thanks
    I have used 2 classes:
    NumberDisplay and ClockDisplay
    the clock automatically convert hours after 12 noon such as 14:34 to 02:34 so all i need is to add PM and AM accordingly.
    NumberDisplay classs:
    public class NumberDisplay
        private int limit;
        private int value;
        public NumberDisplay(int rollOverLimit)
            limit = rollOverLimit;
            value = 0;
        public int getValue()
            return value;
        public String getDisplayValue()
            if(value < 10)
                return "0" + value;
            else
                return "" + value;
        public void setValue(int replacementValue)
            if((replacementValue >= 0) && (replacementValue < limit))
                value = replacementValue;
            else if ( (replacementValue>=limit) && (replacementValue>=0) )
               value=replacementValue-12;
        public void increment()
            value = (value + 1) % limit;
    }ClockDisplay class:
    public class ClockDisplay
        private NumberDisplay hours;
        private NumberDisplay minutes;
        private String displayString;    // simulates the actual display
        public ClockDisplay()
            hours = new NumberDisplay(12);
            minutes = new NumberDisplay(60);
            updateDisplay();
        public ClockDisplay(int hour, int minute)
            hours = new NumberDisplay(12);
            minutes = new NumberDisplay(60);
            setTime(hour, minute);
        public void timeTick()
            minutes.increment();
            if(minutes.getValue() == 0) {
                hours.increment();
            updateDisplay();
        public void setTime(int hour, int minute)
            hours.setValue(hour);
            minutes.setValue(minute);
             updateDisplay(); 
        public String getTime()
            return displayString;
        private void updateDisplay()
            displayString = hours.getDisplayValue() + ":" +
                            minutes.getDisplayValue();
    }As you see value=replacementValue-12; do the job.
    i tried do this:
    if(hours.setValue(hour)>=12)
    updateDisplayPm();
    else
    updateDisplay();
    and for
    private void updateDisplayPm()
    displayString = hours.getDisplayValue() + ":" +
                            minutes.getDisplayValue() + "PM";but it didnt work.
    so should iwrite if statemnt in NumberDisplay class and refer it to ClockDisplay or i can do something in clockDisplay.
    Looking forward to hear from you
    thanks

    solved
    public class NumberDisplay
        private int limit;
        private int value;
        private boolean isam;
        public NumberDisplay(int rollOverLimit)
            limit = rollOverLimit;
            value = 0;
        public int getValue()
            return value;
          public boolean getAm()
                 return isam;
        public String getDisplayValue()
            if(value < 10)
                return "0" + value;
            else
                return "" + value;
        public void setValue(int replacementValue)
            if((replacementValue >= 0) && (replacementValue < limit))
                value = replacementValue;
                isam=true;
            else if ( (replacementValue>=limit) && (replacementValue>=0) )
               value=replacementValue-12;
               isam=false;
        public void increment()
            value = (value + 1) % limit;
    public class ClockDisplay
        private NumberDisplay hours;
        private NumberDisplay minutes;
        private String displayString;    // simulates the actual display
        private NumberDisplay amCheck;
        public ClockDisplay()
            hours = new NumberDisplay(12);
            minutes = new NumberDisplay(60);
            updateDisplay();
        public ClockDisplay(int hour, int minute)
            hours = new NumberDisplay(12);
            minutes = new NumberDisplay(60);
            setTime(hour, minute);
        public void timeTick()
            minutes.increment();
            if(minutes.getValue() == 0) {
                hours.increment();
            updateDisplay();
        public void setTime(int hour, int minute)
            hours.setValue(hour);
            minutes.setValue(minute);
           updateDisplay(); 
        public String getTime()
            return displayString;
        private void updateDisplay()
            if(hours.getAm())
            displayString = hours.getDisplayValue() + ":" +  minutes.getDisplayValue() + "AM";
            else
             displayString = hours.getDisplayValue() + ":" +  minutes.getDisplayValue() + " PM";
    }

  • Need help adding footer to PDF

    I have Adobe Acrobat XI and I am trying to add a footer to a PDF, but I only receive a pop up message: You do not have sufficient permissions to perform this task.  Please help!!

    I think what you actually need is a dynamic stamp. Try searching these forums and also acrobatusers.com . There's a lot of information about it.

  • Need help on search help on selection screen field

    Hi guyz,
    Please tell me how to pass the parameter or restrict the below search help.
    *s_bsart FOR ekko-bsart . " Doc. Type*
    For the above selection screen field i need to display the data only for cat = F if i click search help.
    Thanks,
    Mohamed Kaleel

    Hi,
    Use At selection-screen for value-request for s_bsart.
    SELECT_OTPIONS: s_bsart FOR ekko-bsart.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bsart.
    CALL SCREEN 100 STARTING AT 10 5
    ENDING AT 50 10.
    MODULE value_list OUTPUT.
    SUPPRESS DIALOG.
    LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
    SET PF-STATUS space.
    NEW-PAGE NO-TITLE.
    s_bsart-low = 'F' / 'CAT=F'.
    write :/ s_bsart-low.
    Hide: s_bsart-low
    clear s_bsart-low.
    ENDMODULE.
    AT LINE-SELECTION.
    LEAVE TO SCREEN 0.
    This will resolve the issue.
    Regards,
    Gurpreet

  • I need help adding text!

    I need some help with PE 12 and adding text...

    this forum is for photoshop elements and photoshop elements doesn't support editing GIF.
    You might want to post to photoshop community Photoshop General Discussion

  • Need help adding a second page on reports builder, paper layout.

    Hi,
    I have a requirement where I need to create a paper layout using Reports Builder (10.1.2.0.2). This report will print out the following:
    1) Invoice
    2) VAT Slip (on a separate page)
    So far I have created the invoice part and it is printing properly. Now I want to add the Vat slip. When I use the "Trailer Section" on the rdf report, I create a frame and inserted some text. The report ran just fine. Then in the same frame, I added a repeating frame. And now the report is completing with the following error:
    APPLLCSP Environment Variable set to :
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.UTF8
    stat_low = 86
    stat_high = 0
    emsg:was terminated by signal 6
    Enter Password:
    MSG-00100: DEBUG: AfterPForm_Trigger +
    MSG-00100: DEBUG: Multi Org established.
    MSG-00100: DEBUG: AfterParam_Procs.Get_Country_Details
    MSG-00100: DEBUG: Get_Country_Description.
    MSG-00100: DEBUG: AfterParam_Procs.Switch_On_Debug
    MSG-00100: Running in debug mode
    MSG-00100: DEBUG: AfterParam_Procs.Get_Trx_Number_Low
    MSG-00100: DEBUG: AfterParam_Procs.Get_Trx_Number_High
    MSG-00100: DEBUG: AfterParam_Procs.Get_Tax_Option
    MSG-00100: DEBUG: AfterPForm_Trigger -
    *** glibc detected *** ora_rw20_run: munmap_chunk(): invalid pointer: 0x09067b10 ***
    Anyone have any idea why this is happening? Any help is much appreciated.
    Or is there any way I can add a page that has to be printed after the invoice?
    Thanks
    -Nelly

    If you have created your own template (but it sounds like you haven't) you will need to 'capture' that page so it repeats on following pages.
    The whole process is described here:
    "Letterhead and follower sets"
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=182&mforum=iworktips ntrick
    Peter

  • New to Fios - So confused how to find anything on!!! - Need help with search

    Been with Comcast for years and years and just switched to Fios.  With all the channels and various buttons on the remote I'm overwhelmed with trying to figure out what's actually on.
    I understand how to use the search feature to find a show or theme, but what I can't figure out is how do you see a list of results for just programs that are currently on?? 
    It seems the search results are listed in order of channel name and there is nothing on the list that I see that shows which ones are currently on.  I find myself going thru the list, constantly pushing the right arrow key on the remote just to then find out the show is on later in the day or another day.
    Please help!
    Thanks,
    Vince

    The best way to see what's on now is simply to press Up on the remote to bring up the half-screen guide, then use the Ch + and - buttons to quickly scan through it.
    Not the solution you wanted. Perhaps you should suggest it in the Ideas forum.

Maybe you are looking for

  • Update placed PDF files to recognize transparency

    I have used Croptima InPlate to create an imposed cut and stack imposition of a large 3800 variable data project. Due to the size of the file, I've only imposed the black plate variable data. I want to use Acrobat's add background tool to add an impo

  • Cli templates prime 2.1

    HI I was wondering. Is it possible to run a CLI template that does the following. 1. Running the CDP neighbor command to find out who the neighbors are. 2. And automaticly entering a description command on the interface with the hostname and IP that

  • SD Staticall Condition Not Posting Into Accounting

    Dear All, Need your help. Urgent... My business requirement is to post Staticall condition value in G/L count. For that I did the following config. 1. V/06: Configured new condition type ZCRL,with Cond. class :Discount or surcharge ,Calculat.type :Pe

  • Problem building schema in jdeveloper

    Hi i am invoking a web service through a partner link. But when I click on rrefresh button in structure tab, its shows this error: Referência inválida: 'urn:unApTypes:TApFieldType' oracle.tip.tools.ide.common.xsdgrammar.SchemaGrammarException: Referê

  • Siebel 7.8 and 8.0 on Vista

    Hi Gurus , A general query. Can Siebel tools and client be installed on Vista operating system. regards, Sandy