Inserting Icons in JTextPane with setEditable=false

Aloha!
I'm working on this for years now, but i haven't found an acceptable solution yet.
The problem: I have a JTextPane, where the user shall not be able to edit anything by clicking onto the JTextPane. So I have to setEditable=false. Now I want to insert an icon with insertIcon and therefore i have to setEditable = true. But for short time it's now possible for the user to click onto the screen and change the caretPosition, which must be prevented at all costs (because I'm working with the expected caretPosition of course)! This only happens when I try the brute force testing method, but it happens sometimes...
So can someone give me a better solution than:
setEditable = true;
insertIcon(blahblah);
setEditable = false;
Thanks a lot for your attention,
Holm

To use HTML, you must use javax.swing.text.html.HTMLDocument instead of StyledDocument,
Instead of StyleConstants, you must use javax.swing.text.html.HTML$Tag and javax.swing.text.html.HTML$Attribute.
And you can use an HTMLEditorKit instead of DefaultEditorKit.
this is an example of initialization:
javax.swing.text.html.HTMLEditorKit htmlEditorKit = new javax.swing.text.html.HTMLEditorKit();
javax.swing.text.html.HTMLDocument htmlDoc = (javax.swing.text.html.HTMLDocument)htmlEditorKit.createDefaultDocument();
yourJTextPane.setEditorKit(htmlEditorKit);
yourJTextPane.setDocument(htmlDoc);
yourJTextPane.setEditable(true);
yourJTextPane.setContentType("text/html");and you can use it by yourJTextPane.setText(HtmlCodeString)
HTMLDocument and HTMLEditorKit allow you main modifications.
thanks for duke dollars :)

Similar Messages

  • Getting inserted icons from JTextPane

    I have inserted some text including icons in JTextPane. Now i want to copy all contents as such in second Jtextpane. Plz help me

    http://liquidaurum.imgur.com/all/
    This is what's happening, and same thing for terminal

  • Insert Icon in JTextPane URGENT!!

    Hi guys. Look at the following code. What am i doing wrong? It used to work, but now, i am not able to get any icon in the text pane. please try to point out the error or if u have any similar code to that? Thanx much
    -Raam
    public void appendToChatArea(
    String message,
    String fontFamily,
    String fontStyle,
    int fontSize,
    Color fontColor) {
    SimpleAttributeSet styles = new SimpleAttributeSet();
    StyleConstants.setFontFamily(styles, fontFamily);
    StyleConstants.setForeground(styles, fontColor);
    StyleConstants.setFontSize(styles, fontSize);
    if (fontStyle.equalsIgnoreCase("plain")) {
    StyleConstants.setBold(styles, true);
    } else if (fontStyle.equalsIgnoreCase("bold")) {
    StyleConstants.setBold(styles, true);
    } else if (fontStyle.equalsIgnoreCase("italic")) {
    StyleConstants.setItalic(styles, true);
    message = message.trim();
    if (!message.equals("")) {
    Document doc = ta_chatArea.getDocument();
    try {
    int i = 0;
    while (i < message.length()) {
    char currChar = message.charAt(i);
    if (currChar == '(' && i + 2 < message.length()) {
    if (currChar == '(' && message.charAt(i + 2) == ')') {
    int test = -1;
    for (int j = 0; j < 10; j++) {
    String converter = "" + j;
    if (message.charAt(i + 1) == converter.charAt(0)) {
    test = j;
    break;
    if (test >= 0) {
    Icon emotion = new ImageIcon(allEmotions.elementAt(test).toString());
    doc.insertString(doc.getLength(), " ", styles);
    ta_chatArea.select(doc.getLength() - 1, doc.getLength() - 2);
    ta_chatArea.insertIcon(emotion);
    doc.remove(doc.getLength() - 1, 1);
    i += 3;
    } else {
    doc.insertString(doc.getLength(), "" + currChar, styles);
    i++;
    } else if (currChar == '(' && i + 3 < message.length()) {
    if (currChar == '(' && message.charAt(i + 3) == ')') {
    int test = -1;
    for (int j = 10; j < allEmotions.size(); j++) {
    String converter = "" + j;
    if (message.charAt(i + 1) == converter.charAt(0)
    && message.charAt(i + 2) == converter.charAt(1)) {
    test = j;
    break;
    if (test >= 0) {
    Icon emotion = new ImageIcon(allEmotions.elementAt(test).toString());
    doc.insertString(doc.getLength(), " ", styles);
    ta_chatArea.select(doc.getLength() - 1, doc.getLength() - 2);
    ta_chatArea.insertIcon(emotion);
    doc.remove(doc.getLength() - 1, 1);
    i += 4;
    } else {
    doc.insertString(doc.getLength(), "" + currChar, styles);
    i++;
    } else {
    doc.insertString(doc.getLength(), "" + currChar, styles);
    i++;
    } else {
    doc.insertString(doc.getLength(), "" + currChar, styles);
    i++;
    doc.insertString(doc.getLength(), "\n", styles);
    ta_chatArea.setCaretPosition(doc.getLength());
    ta_userMessage.setText("");
    b_send.setEnabled(false);
    ta_userMessage.requestFocus();
    } catch (Exception e) {
    System.err.println("Could not append to text area : " + e);
    }

    Hi,
    Just put @xx@ where you need the icon in the message.
    Replace the xx with the value from ICON table.
    You can list all icons from table ICON. Just go to SE11-> Table contents and when you are in the selection screen, Pull down the possible values for field ICON, once you select the required Icon you will see a @xx@ code. Use that in your message .
    This works fine with normal Write stmnt or when you display Information message
    Hope this helps
    Ravi.

  • Icon on JDialog with setResizable(false)

    Hi ,
    Can anybody know how to provide an Icon on the caption bar for the JDialog when we set the resizable feature to 'false' ?
    I observed, when we do setResizable(true), icon comes up but does not
    show when we do setResizable(false).
    Also when we use JOptionpane.showMessageDialog() which is not set as resiable does not show up icons as well. Can we do anything in this context as well ?
    Thanking you in advance.

    Leave resizing enabled an add a componentResizedHandler which pack()s the dialog.
    Altough this will allow the user to resize the dialog, the dialog will also revert to it's initial size.
    HTH,
    Klaus

  • Insertion of icons into JTextPane

    Hello!
    I am trying to insert icons into JTextPane object, and I got a problem.
    My partial code is as follows...
    StyleConstants.setIcon(s, icnIcons);
    doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
    doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
    In the above code, s is an object of Style, and icnIcons is an object of ImageIcon, and doc is an object of StyledDocument.
    And the style, s, is registered with a name, "icon".
    If I execute the above code, then only one icon is displayed. But the length of the text is increased by 2.(I check this using doc.getLength() method.)
    So, I make a little change to the above code like the following:
    StyleConstants.setIcon(s, icnIcons);
    doc.insertString(doc.getLength(), "I\n", doc.getStyle("icon")); //changed
    doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
    I just add "\n". And the second code is working, and displays two icons.
    But the two icons are on the separate line.
    And if I use two different icons, that is, two different styles, in the first code segment, then it works and shows the two icons on the same line, though I didn't use the "\n".
    Why does this happen?
    I am so confused. Please help me.
    Thanks for every body!
    Regards

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import javax.swing.text.*;
    public class IconPane {
        private void showTest(BufferedImage[] images) throws IOException {
            JTextPane textPane = new JTextPane();
            // Add some content.
            File file = new File("IconPane.java");
            BufferedReader br = new BufferedReader(
                                new InputStreamReader(
                                new FileInputStream(file)));
            textPane.read(br, file);
            br.close();
            // Make up a couple of styles.
            int pos1 = 875, pos2 = 876;
            StyledDocument doc = textPane.getStyledDocument();
            Style style = textPane.addStyle("icon1", null);
            StyleConstants.setIcon(style, new ImageIcon(images[0]));
            // Set  icons.
            doc.setCharacterAttributes(pos1, 1, style, false);
            style = textPane.addStyle("icon2", null);
            StyleConstants.setIcon(style, new ImageIcon(images[1]));
            doc.setCharacterAttributes(pos2, 1, style, false);
            // Add the icons again with the insertString method.
            addContent(doc);
            // Show me.
            JScrollPane scrollPane = new JScrollPane(textPane);
            scrollPane.setPreferredSize(new Dimension(500,400));
            textPane.addMouseMotionListener(mouseInput);
            JOptionPane.showMessageDialog(null, scrollPane, "",
                                          JOptionPane.PLAIN_MESSAGE);
        private void addContent(StyledDocument doc) {
            int pos1 = 1667, pos2 = 1669;
            try {
                // Try inserting icons with insertString.
                doc.insertString(pos1, " ", doc.getStyle("icon1"));
                doc.insertString(pos2, " ", doc.getStyle("icon2"));
            } catch(BadLocationException e) {
                System.out.printf("bad location error: %s%n", e.getMessage());
        public static void main(String[] args) throws IOException {
            String[] ids = { "--g--", "---h-" };
            BufferedImage[] images = new BufferedImage[ids.length];
            for(int j = 0; j < images.length; j++)
                images[j] = ImageIO.read(new File("images/geek" + ids[j] + ".gif"));
            new IconPane().showTest(images);
        private MouseMotionAdapter mouseInput = new MouseMotionAdapter() {
            public void mouseMoved(MouseEvent e) {
                int pos = ((JTextComponent)e.getSource()).viewToModel(e.getPoint());
                System.out.println(String.valueOf(pos));
    }

  • Visually express setEditable(false)

    Hello,
    On the GUI I write, if a user clicks an a radio button, a text field must not be editable anymore. It works with setEditable(false) but it has no graphical effect.
    So Is there a way to put the text field and its associate label in gray?
    I searched the API and various doc, but found nothing.
    Thanks for help
    Thierry

    Like setBackGround and setForeGround.

  • Insert String to JTextPane as hyperlink

    Hi,
    I have a JTabbedPane with 2 tabs, on each tab is one panel.
    On first pannel I add JTextPane and I would like to insert in this JTextPane some hyperlinks.
    I found some examples in forum, but doesn't work for me.
    Could somebody help me ?
    Thank's.
    Here is my code :
    JTextPane textPane = new JTextPane();
    textPane.setPreferredSize(new Dimension(500,300));
    HTMLEditorKit m_kit = new HTMLEditorKit();
    textPane.setEditorKit(m_kit);
    StyledDocument m_doc = textPane.getStyledDocument();
    textPane.setEditable(false); // only then hyperlinks will work
    panel1.add( textPane,BorderLayout.CENTER); //add textPane to panel of
    //JTabbedPane
    String s = new String("http://google.com");
    SimpleAttributeSet attr2 = new SimpleAttributeSet();
    attr2.addAttribute(StyleConstants.NameAttribute, HTML.Tag.A);
    attr2.addAttribute(HTML.Attribute.HREF, s);
    try{
    m_doc.insertString(m_doc.getLength(), s, attr2);
    }catch(Exception excp){};
    The String s is displayed like text not like hyperlink..

    Hi , You can take a look at this code , this code inserts a string into a StyledDocument in a JTextPane as a hyperlink and on clicking fires the URL on the browser.
    /* Demonstrating creation of a hyperlink inside a StyledDocument in a JTextPane */
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.Border;
    import javax.swing.text.*;
    public class Hyperlink extends JFrame {
        private Container container = getContentPane();
        private int toolXPosition;
        private int toolYPosition;
        private JPanel headingPanel = new JPanel();
        private JPanel closingPanel = new JPanel();
        private final static String LINK_ATTRIBUTE = "linkact";
        private JTextPane textPane;
        private StyledDocument doc;
        Hyperlink() {
              try {
                   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
                   setSize(300, 200);
                   Rectangle containerDimension = getBounds();
                   toolXPosition = (screenDimension.width - containerDimension.width) / 10;
                            toolYPosition = (screenDimension.height - containerDimension.height) / 15;
                            setTitle("HYPERLINK TESTER");
                         setLocation(toolXPosition, toolYPosition);
                         container.add(BorderLayout.NORTH, headingPanel);
                         container.add(BorderLayout.SOUTH, closingPanel);
                   JScrollPane scrollableTextPane;
                   textPane = new JTextPane();
                   //for detecting clicks
                   textPane.addMouseListener(new TextClickListener());
                   //for detecting motion
                   textPane.addMouseMotionListener(new TextMotionListener());
                   textPane.setEditable(false);
                   scrollableTextPane = new JScrollPane(textPane);
                   container.add(BorderLayout.CENTER, scrollableTextPane);
                   container.setVisible(true);
                   textPane.setText("");
                   doc = textPane.getStyledDocument();
                   Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
                   String url = "http://www.google.com";
                   //create the style for the hyperlink
                   Style regularBlue = doc.addStyle("regularBlue", def);
                   StyleConstants.setForeground(regularBlue, Color.BLUE);
                   StyleConstants.setUnderline(regularBlue,true);
                   regularBlue.addAttribute(LINK_ATTRIBUTE,new URLLinkAction(url));
                   Style bold = doc.addStyle("bold", def);
                   StyleConstants.setBold(bold, true);
                   StyleConstants.setForeground(bold, Color.GRAY);
                   doc.insertString(doc.getLength(), "\nStarting HyperLink Creation in a document\n\n", bold);
                   doc.insertString(doc.getLength(), "\n",bold);
                   doc.insertString(doc.getLength(),url,regularBlue);
                   doc.insertString(doc.getLength(), "\n\n\n", bold);
                   textPane.setCaretPosition(0);
              catch (Exception e) {
         public static void main(String[] args) {
              Hyperlink hp = new Hyperlink();
              hp.setVisible(true);
         private class TextClickListener extends MouseAdapter {
                 public void mouseClicked( MouseEvent e ) {
                  try{
                      Element elem = doc.getCharacterElement(textPane.viewToModel(e.getPoint()));
                       AttributeSet as = elem.getAttributes();
                       URLLinkAction fla = (URLLinkAction)as.getAttribute(LINK_ATTRIBUTE);
                      if(fla != null)
                           fla.execute();
                  catch(Exception x) {
                       x.printStackTrace();
         private class TextMotionListener extends MouseInputAdapter {
              public void mouseMoved(MouseEvent e) {
                   Element elem = doc.getCharacterElement( textPane.viewToModel(e.getPoint()));
                   AttributeSet as = elem.getAttributes();
                   if(StyleConstants.isUnderline(as))
                        textPane.setCursor(new Cursor(Cursor.HAND_CURSOR));
                   else
                        textPane.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
         private class URLLinkAction extends AbstractAction{
              private String url;
              URLLinkAction(String bac)
                   url=bac;
                 protected void execute() {
                          try {
                               String osName = System.getProperty("os.name").toLowerCase();
                              Runtime rt = Runtime.getRuntime();
                        if (osName.indexOf( "win" ) >= 0) {
                                   rt.exec( "rundll32 url.dll,FileProtocolHandler " + url);
                                    else if (osName.indexOf("mac") >= 0) {
                                      rt.exec( "open " + url);
                              else if (osName.indexOf("ix") >=0 || osName.indexOf("ux") >=0 || osName.indexOf("sun") >=0) {
                                   String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror",
                                     "netscape","opera","links","lynx"};
                                   // Build a command string which looks like "browser1 "url" || browser2 "url" ||..."
                                   StringBuffer cmd = new StringBuffer();
                                   for (int i = 0 ; i < browsers.length ; i++)
                                        cmd.append((i == 0  ? "" : " || " ) + browsers[i] +" \"" + url + "\" ");
                                   rt.exec(new String[] { "sh", "-c", cmd.toString() });
                   catch (Exception ex)
                        ex.printStackTrace();
                 public void actionPerformed(ActionEvent e){
                         execute();
    }Here , what I have done is associated a mouseListener and a mouseMotionListener with the JTextPane and I have created the hyperlink look with a Style of blue color and underline and have added the LINK_ATTRIBUTE to that Style which takes care of listening to mouse clicks and mouse motion.
    The browser can be started in windows using the default FileProtocolHandler using rundll32 and in Unix/Sun we have to take a wild guess at which browser could be installed , the first browser encountered is started , in Mac open command takes care of starting the browser.
    Hope this is useful.

  • A Simple Question... inserting image into JTextPane...

    Well my problem is very simple (but not for me). Before I explain it, please take a look at a simple class...
    public class Window extends JTextPane {
        Window() {
            super();
        }// Window
        public void appendText(String s,Color col) throws BadLocationException {
            StyledDocument sd = getStyledDocument();
            SimpleAttributeSet attr = new SimpleAttributeSet();
            StyleConstants.setForeground(attr,col);
            sd.insertString(sd.getLength(),s,attr);
          *     THE POINT - what should I write here, please consult description followed by the class.
        } //appendText
    } //classThe appendText method simply appends the text in text pane with desired color. Now I want to know what should I write at point THE POINT so that at end of appended string an icon (suppose end.gif) is added and is displayed in text pane. Simple?
    Stay happy,
    fadee

    Dear Fadee,
    here is a small programe for inserting images into JTextPane;
    find this comment and start
    /*All Code In this Button Action*/if you need any thing feel free to tell me,
    i'm with you brother, i'll do my best :O)
    -Best regards
    mnmmm
    * Fadee.java
    * Created on June 7, 2002, 1:13 AM
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.color.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    * @author  Brother Mohammad, Cairo, Egypt.
    * @version
    public class Fadee extends javax.swing.JFrame {
        JTextPane   tp;
        JButton     b;
        StyledDocument sd;
        SimpleAttributeSet attr;
        public Fadee() throws BadLocationException {
            b = new JButton("Press");
            tp = new JTextPane();
            b.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    /*All Code In this Button Action*/
                    try {
                        sd = tp.getStyledDocument();
                        attr = new SimpleAttributeSet();
                        /*get default style*/
                        Style def = StyleContext.getDefaultStyleContext().
                                            getStyle(StyleContext.DEFAULT_STYLE);
                        /*add style for text default style*/
                        Style regular = tp.addStyle("regular", def);
                        StyleConstants.setFontFamily(def, "SansSerif");
                        StyleConstants.setAlignment(def, StyleConstants.ALIGN_CENTER);
                        StyleConstants.setForeground(def, Color.RED);
                        /*add style for icon create as many as icons you have
                         and don't forget to resize the photo at small size
                         to fit with font size*/
                        Style s = tp.addStyle("icon", regular);
                        StyleConstants.setAlignment(s, StyleConstants.ALIGN_JUSTIFIED);
                        StyleConstants.setIcon(s, new ImageIcon("d:\\My Photo.GIF"));
                        /*here is what user will see*/
                        sd.insertString(sd.getLength(), "Allah Akbar ", tp.getStyle("regular"));
                        sd.insertString(sd.getLength(), " ", tp.getStyle("icon"));
                    } catch (BadLocationException x) {
                        x.printStackTrace();
            getContentPane().setLayout(new BorderLayout());
            getContentPane().add(b, BorderLayout.NORTH);
            getContentPane().add(tp, BorderLayout.CENTER);
            setSize(500, 500);
            setVisible(true);
        public static void main(String args[]) {
            try {
                Fadee f = new Fadee();
            } catch (BadLocationException x) {
                x.printStackTrace();
    }

  • Inserting Component in JTextPane

    hai
    I have a problem while inserting components in JTextPane
    i first inserted text using insertString() function and then a JLabel using
    insertComponent() function but the Label is appearing before the text.
    This is the case with any of the component that is being added
    The components are being added before the text
    can someone tell me a solution by which the components appear in the order they
    were added
    Thanking you in anticipation

    u r inserting the component at the 0 caret position, so as ur need set the caret position where u want to insert the component like..
    textPane.setText("Hello");
    textPane.setCaretPosition(5);
    textPane.insertComponent(new JLabel("World"));

  • Why doesn't calling setEditable(false) disable cursoring

    I want to have JFormattedTextField format my date fields for me. It does a good job of it, so why wouldn't I?
    I have a need to display a non-editable date for reference purposes. Unfortunately I discovered that the cursoring is still active when setEditable(false) is called. In order to prevent this, I have had to subclass DateFormatter in order to override getActions() to return null if I don't want incrementing. There are a number of problems with this:
    1) setEditable on JFormattedTextField should have been enough. If I don't want it editable, then I don't want cursoring. I would have thought that was obvious.
    2) Notwithstanding that, the correct method to override for incrementing is really getSupportsIncrement(), but this has no modifier, so is in the 'friendly' status, which means it can only be overridden in the package.
    3) While I can override getActions, this signature leaves itself open to have other actions than "increment" and "decrement" returned . That is, it works now, but if sun adds more actions to the list of actions returned by getActions(), then my override is broken.
    Is there a bug in there somewhere?
    Thanks, Andrew

    1) setEditable on JFormattedTextField should have
    been enough. If I don't want it editable, then I
    don't want cursoring. I would have thought that was
    obvious.Nope not really. What if the user wants to copy some text using the keyboard?

  • How i can insert icon only in the root node

    i need to insert icon only in the root node, with the other nodes i don't have problem.

    Use a jQuery menu like Superfish, or you can purchase an extension like the ones offered by Project VII
    http://plugins.jquery.com/superfish/
    http://www.projectseven.com/products/index.htm

  • JScrollPane on JTextPane with GridBagLayout

    I am havign problem setting a scrollbar on a JTextPane. All I want. I want to add just buttons in one column from top to bottom, and I want the scrollbar so I can see all the buttons. I need to use GridBagLayout on the JTextPane. below is a simplified version of my code...anyone plz help..
    public class ScrollTestMain {
    public static void main(String[] args) {
    JFrame frame=new JFrame("test");
    JTextPane tp = new JTextPane();
    JScrollPane sp=new JScrollPane(tp);
    GridBagLayout gridbag=new GridBagLayout();
    GridBagConstraints c=new GridBagConstraints();
    tp.setLayout(gridbag);
    c.weightx=100;
    c.weighty=100;
    for (int i=0;i<16;i++) {
    c.gridx=0;
    c.gridy=i;
    JButton button =new JButton("button"+i);
    gridbag.setConstraints(button,c);
    System.out.println("for loop "+i);
    tp.insertComponent(button);
    frame.setSize(200,200);
    frame.setVisible(true);
    frame.getContentPane().add(sp, BorderLayout.CENTER);
    tp.setEditable(false);
    frame.show();
    I want the buttons to be like:
    button0
    button1
    button2
    button3
    button4
    and the vertical scrollbar so I can scrolldown to see all the buttons.

    From the "An Example of Using a Text Pane" section on the page How to Use Editor Panes and Text Panes in the java tutorial.
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class TextPaneTest
        public static void main(String[] args)
            String newline = "\n";
            String[] initString = new String[8];
            String[] initStyles = new String[8];
            for(int j = 0; j < 8; j++)
                initString[j] = " " + newline;
                initStyles[j] = "button" + j;
            JTextPane textPane = new JTextPane();
            StyledDocument doc = textPane.getStyledDocument();
            addStylesToDocument(doc);
            try
                for(int j = 0; j < initString.length; j++)
                    doc.insertString(doc.getLength(), initString[j],
                                     doc.getStyle(initStyles[j]));
            catch(BadLocationException ble)
                System.out.println("unable to init text");
            JScrollPane scrollPane = new JScrollPane(textPane);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(scrollPane);
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
        private static void addStylesToDocument(StyledDocument doc)
            Style def = StyleContext.getDefaultStyleContext().
                            getStyle(StyleContext.DEFAULT_STYLE);
            Style space = doc.addStyle("space", def);
            StyleConstants.setSpaceAbove(space, 40f);
            StyleConstants.setLeftIndent(space, 75f);
            doc.setLogicalStyle(0, space);
            for(int j = 0; j < 8; j++)
                Style s = doc.addStyle("button" + j, space);
                JButton button = new JButton("button " + j);
                button.setCursor(Cursor.getDefaultCursor());
                button.setMargin(new Insets(5,5,5,5));
                button.setActionCommand("button " + j);
                //button1.addActionListener();
                StyleConstants.setComponent(s, button);
    }

  • Transferred itunes library from Windows XP PC to new Windows 7 PC. plugged in 3rd gen Ipod. Ipod icon appears along with playlists, music etc. Songs are grayed out and won't play. Please help!

    I recently transferred itunes library from windows XP PC to new Windows 7 PC. The transfer was successful, however when I plug my 3rd gen Ipod Nano into the new PC, the Ipod icon appears along with the music, playlists, etc. The songs are shown but are 'grayed out' and wont play or sync.The 'Devices & Printers' window in new PC shows icon for Ipod driver & is OK. The icon for the Ipod appears but depicts a delta shaped warning icon that states that the Ipod is'not operating properly'. Tried troubleshooting. The troubleshooting message states the the Ipod is 'disconnecting'. Can you help me with this problem?        

    Then, I dropped the entire itunes file from the old PC (XP) into an empty external drive.
    That "itunes file from the old PC"?  Is that the iTunes folder, from the old PC, that was in the user home folder's Music folder?
    All of the library, playlists, etc. from the ipod as they always have been are shown, by they are 'grayed out' and will not open or play.
    That's on the iPod, correct?  Are all of your old playlists in iTunes, from the old PC, still there in iTunes on the new PC?  Are the songs in iTunes still playable?
    This document provides the steps to transfer a complete iTunes library between two computers.  See the section called External drive.
    iTunes: How to move your music to a new computer - Apple Support
    There are many steps, but this is a summary.  (1) On the old PC, consolidate all of your iTunes data into the iTunes folder.  (2) Copy this iTunes folder to the external drive.  (3) On the new PC (that has iTunes installed but NOT running), replace its existing iTunes folder with the one from the old PC (on the external drive).  When you run iTunes, it uses the iTunes folder from the old PC, and it should look like iTunes on the old PC (with all the playlists, ratings, play count, etc.), and your iPod will see the iTunes library as the same iTunes library (because it is the same library).
    If you did something different, and the old PC is still accessible, you may want to try it using the method from the linked document.

  • How to insert and edit equations with Math Type in IBA??

    Hi,
    I want to add  fractions in IBA with Math Type.
    Here is what i found:
    And here is the General Preferences
    Like you see, i can't select Insert and edit equations with Math Type, it's grey.
    How can i use Math Type?
    Tx

    We have an article that describes not only how to use MathType with iBooks Author (iBA), but also using LaTeX and MathML. http://www.dessci.com/en/support/mathtype/works_with.asp#!target=ibooks_author_m ac
    It's important to note that no matter how you get equations into iBA, all equations are represented as MathML in the published iBook. (except, obviously I hope, equations that are simply images that you insert)
    If you need more help, feel free to ask here.
    Bob Mathews
    Design Science

  • After I make a note in the notes icon that came with the ipad, it immediately is emailed to my email address and disappears from notes. How can I make it stay on notes?

    After I write a note in the notes icon that came with the ipad, it immediately emails it to my email account and erases it from the note pad. How do I make it stay on the notepad? I don't particularly want it emailed to me.

    I have a test with some questions (multiple choice, FIB, matching, etc). I have just one button to submit all the answers, and after submiting the student can see his score and review the test to know where he failed. He can't answer again. However, he can change the answer multiple times before submiting.
    "if i turn on success/failure captions the student will see them while answering" - before submitting
    "if i turn them off he wont know what's the right answer" - after submitting
    My results page is the default. I didn't use any variable. When i go to the results page after reviewing the test all the entry boxes are "wrong".

Maybe you are looking for

  • Changing a Team Name

    UCCE 8.5 Should changing a Team Name remove recorded files from Supervisor Record Viewer for the affected Team? It appears so in our case but is this normal? Dan

  • Replace data in csv file

    I am creating this script to search the code of the open file and search this code in a csv file and then change the information in this line for the information contained in the open file, but when the array is written to the file, the value is not

  • I just upgrated to 14 and now pages aren't fully loading, I have to do a hard refresh and that doesn't always work.

    I just upgraded to version 14 and now pages aren't fully loading. I have to do a hard refresh in order to get them to load but sometimes that's not an option. For instance when I want to upload a picture to tinypic.com a pop up comes up where you ent

  • Can find AppleTV in iTunes

    Help please! AppleTV is connected to network (can see Movie Trailers and YouTube) and Mac is also connected to the same network (internet is working). Somehow, can find AppleTV in iTunes. Can someone please kindly help? Thanks a lot.

  • Nokia Email (v 2.1.0) - how to update?!?

    Hi All, I have Nokia e52 with Nokia Email preinstalled.  In connections configuration I can not choose Destination Network, only Access Points appear in the list. I have read on Nokia Messaging blog about this issue. It is fixed apparently. I cannot