Warning trying to underline JLabel's text?

Hello everyone. I've been trying to make the font of a JLabel underlined. I found this solution:Map map = myView.getMyJLabel().getFont().getAttributes();
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
myView.getMyJLabel().setFont(new Font(map));However, I can't make this 2 warnings dissapear:
Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map<K,V> should be parameterized.
Type safety: The expression of type Map needs unchecked conversion to conform to Map<? extends AttributedCharacterIterator.Attribute, ?>
I've also tried this:Map<TextAttribute, ?> map = myView.getMyJLabel().getFont().getAttributes();
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
myView.getMyJLabel().setFont(new Font(map));But in this case I get the following error:
The method put(TextAttribute, capture-of ?) in the type Map<TextAttribute, capture-of ?> is not applicable for the arguments (TextAttribute, Integer)
Does anyone know how can I get rid of this warnings or maybe, a simpler way to underline a JLabel's text?
Thanks in advance :)

1) During field validation (data entry error by the
user), the name of the field (via the registered
label) is used in the error dialog
2) During form validation (save button was
clicked), required fields that are still blank are
shown to the user in a dialog (again, using the text
of the field's label).
3) Required fields on the form get a red asterisk
for the label's icon that get turned off after the
field had been filled in. This is a requirement for
us, but I gather not an uncommon one. The presenter
informs the ui that a particular field
isRequired(true/false). The ui looks up the label
for that field and sets him to required(true/false),
which will turn the asterisk icon on/off.
In addition, we use JLabels for hyperlinks to other
forms in our app. Yes, they are underlined. Perhaps
not the best way to do it, but we subclassed JLabel
to return the non-html text on the call to getText(),
among other things.Ok, I think I get what you're talking about, but I think you're doingitwrong.com :P
The view has two purposes in my book, 1) to take input data from user, and 2) to give output data to user. Some components like text fields do both. Labels on the other hand, only do output. So back in the model, you have a name of an input field, which you stick in the label after doing some hyperlinky/red-asterisky/whatever presentation stuff to it.
IMHO, you should never be getting any data back from that view component. It's been tainted by transforming it for presentation. When you need to display that label's text elsewhere, you should go back to the model to get it, not the view. Only input data should come from the view. Since that label's output data, it should only ever go to the view.
I'm trying to be insulting or anything, since I know that this is a pretty academic argument I'm making, and we all live in the Real World. I'm just really interested in all this. Now I'm off on a 4 day weekend to Dragon-Con, see you suckers later!

Similar Messages

  • Trying to underline the rectangle of a Text Field

    I am trying to underline the rectangle of a Text Field with a Line Annotation, but I am a little confused.
    The first doubt is about the "Square" vs, the "Rectangle" annotations. What is the difference between them? Has Adobe changed those recently?
    I have tried several variations of the following snippet:
        var x1 = textField.rect[0];
        var y1 = textField.rect[1];
        var x2 = textField.rect[2];
        var y2 = textField.rect[3];
        var underscore = this.addAnnot({
            page: 0,
            type: "Line",
            rect: [x1, y1, x2, y1],
            strokeColor: color.red,
            strokeWidth: 160
    What I am getting is an identity line (i.e., 45-degree) at the lower left corner.
    -Ramon

    Thanks for your reply, try67:
    Could you -or anybody else- please clarify this:
    "The square rect defines top-left-x, top-left-y, bottom-left-x and bottom-left-y.
    For a line it's left-x, left-y, right-x, right-y."
    According to such definition, the square rect does not contain any information about the right side?
    Maybe what you meant to write is:
    "The square rect defines:
    top-left-x, top-left-y, bottom-right-x and bottom-right-y.
    For a line it is
    left-x, left-y, right-x, right-y."
    If that's the case, a rect of zero height is the same thing as a horizontal line. That was my assumption, but I am getting a 45-degree line through the origin.
    TIA,
    -Ramon

  • I'm trying to send a group text but the recipient automatically defaults to send to their email.

    I'm trying to send a group text, but when I type in someones name, it automatically defaults to email.  It doesn't even give me the option to a choose phone number.  It only does with certain contacts.  Also, when a message doesn't go through, usually there is a red try again spot I can click, but when I click it, it only gives me the option to send as an email not text.

    99% chance you don't have the phone number in your contacts correctly.   Make sure there is an area code, etc.

  • TS2755 Hi All - I sent a text using my iphone 5 - It is PAYG and had no money in it. It tried to send as an SMS but gave the 'green button reject message'. After deleting the convo, the phone keeps trying to send the deleted text via SMS and wont stop not

    Hi All - I sent an sms using my iphone 5 - It is PAYG and had no money in it. (stupidly)
    It tried to send as an SMS but gave the 'green button reject message'.(no money)
    Step 2 in this stupidity - the phone keeps trying to send the deleted text via SMS and wont stop notifying me of this. Totally ruining the functionallity of my phone, and more so totally annoying. All I want to do is stop the constant re-trying of sending the deleted SMS.
    Any ideas?
    Many Thanks!

    Hi, many thanks for your help - Pressing and holding sleep/reset hasn't worked, the msg is still continually reporting it is failing to send. I can restore to a previous version however I'll lose my paid apps. Is there any way to work around this. I'm only concerned about one app - Epocam HD which I purchased last month. My last backup on PC is 4 March 13 - before I bought the paid app - Itunes advises me I'll have to re-pay to get my apps (app) back. Even though it advises that icloud backed up this morning at 1:30 am (which although it is before the text, I cannot manually select this restore).
    What a mess!

  • Trying to copy and paste text from a pdf to a webpage

    trying to copy and paste text from a pdf to my iWeb edit page shows up as red lines,  only shows up on the website if I highlight it, please help

    If it only shows up when you highlight it, then it could be your font or your font color. Try changing both to a different font to see if that helps. If not, copy it into a word processor such as Microsoft Word, Pages, or Text Edit to see if it shows up there. If it does, try copying it again from the processor to your webpage.

  • Suppress underline of selection text

    Hello all,
          How to suppress the underline of selection text.
    Ex.
    paramater : f_name type string.
    selection text for f_name is file name
    on selection screen this file name display with underline
    suggest me  tricks  to suppress this underline.
    Answer will be awarded

    Try the below code.
    selection-screen begin of line.
      selection-screen comment 1(30) text-t01. "text-t01 --> File Name
      selection-screen position 35.
      parameters: f_name type string.
    selection-screen end of line.
    Hope this helps.
    Thanks,
    Balaji

  • WARNING: Trying to attach AdfRenderingContext to a thread that already...

    Since configuring my app to use myfaces impl I get the following warning when i deploy my app:
    16:45:10,453 INFO [STDOUT] before - RENDER_RESPONSE(6)
    16:45:10,453 INFO [STDOUT] Apr 12, 2006 4:45:10 PM oracle.adfinternal.view.faces.renderkit.AdfRenderingContext attach
    WARNING: Trying to attach AdfRenderingContext to a thread that already had one.
    16:45:11,515 INFO [STDOUT] after - RENDER_RESPONSE(6)
    16:45:11,515 INFO [STDOUT] Done with Request!
    16:45:11,515 INFO [STDOUT] Apr 12, 2006 4:45:11 PM oracle.adfinternal.view.faces.renderkit.core.CoreRenderKit encodeFinally
    WARNING: No AdfRenderingContext available
    Components are rendering ok though? Is there a known cause for this warning?

    I extended the adf ViewHandlerImpl, and I'm getting the same warning message. Would be nice to know why...

  • I keep finding words on web pages (including my own) written in green and doubly underlined (described as 'Text enhance') that provide a hyperlink to "Groupon". HOw does this happen and how can I stop it?

    I keep finding words on web pages (including my own) written in green and doubly underlined (described as 'Text enhance') that provide a hyperlink to "Groupon". Why does this happen and how can I stop it?

    I dont want to "OPT-OUT"....i want it gone permanently!!

  • I have tried to send photos through text messaging and it will not send. I thought my iPhone 3 was giving out so I got my iPhone 4 last night and still can't send photos through text message. What is the deal??

    I have tried to send photos through text messaging and it will not send. I thought my iPhone 3 was giving out so I got my iPhone 4 last night and still can't send photos through text message. What is the deal??

    Also MMS is supported on a carrier by carrier basis. While mostly every carrier does support ths feature make sure that your carrier allows this functionality.

  • I am trying to send photos and text message and am blocked with message that email server doesn't recognize my username/password combination.How to fix?

    I am trying to send photos and text message from iPhoto which will not go through.Getting message that email server doesn't recognize username/password combo.How to fix?

    In the iPhoto preferences
    Either
    1. Delete and renter your account
    Or
    2  switch to Mail as your email client
    LN

  • Remove Underline From Link Text

    I use GoLive 5.0 - still works great and suits my capabilities.
    However, I cannot figure out how to remove the underline from the text of a link (as one of my clients has requested) - and have the text continue to function as a link.
    Can anyone suggest how to accomplish this?

    Thanks for the tip.  It took some canoodling, but I got it to work. You can see the results at www.freeblues4u.com
    For your reference, here is the method to eliminate underlines on link text for an entire page in GoLive 5.0:
    In Layout click the CSS icon at the right of the header - on the resultant Style Sheet, right click and select "Add Selector" - Choose "a" - In the CSS Selector Inspector window, select the "F" Tab and select "none" in the Decoration menu - Preview and save the Page.
    Thanks Again
    Lee Vyborny
    tropicalglen.com and CountryRoutes.net

  • Macbook does not boot. stuck at grey screen. have tried single user mode, but text stops at AppleIntelCPUPPowerManagement: initialization complete, without anymore prompts. no

    macbook does not boot. stuck at grey screen. have tried single user mode, but text stops at AppleIntelCPUPPowerManagement: initialization complete, without anymore prompts. no hash key appears that will allow me to type in: fsck -fy
    have my trials for IB in one week and my history notes are all on my hard drive, that has not been backed up. help please =(

    macbook does not boot. stuck at grey screen. have tried single user mode, but text stops at AppleIntelCPUPPowerManagement: initialization complete, without anymore prompts. no hash key appears that will allow me to type in: fsck -fy
    have my trials for IB in one week and my history notes are all on my hard drive, that has not been backed up. help please =(

  • How can I insert a vertical line  between two underlined unfilled with text lines.  I am trying to construct an invoice and I need a break.  If I try any of the shapes or inset functions it eliminates my underlined lines and shifts the whole document.

    I am trying to construct an invoice.  How can I install a vertical line between two or more underlined lines to create a break.  I have tried the insert, shapes and nothing works.  If I try any of the functions the whole document shifts to the right and I loose some of the lines.  Is there a work around, or is I work not able to do what I want?   
    Thanks
    Armand

    It sounds as though you may have "Object Causes Wrap" activated for the Line Shape. This will push other content away.
    See the Wrap Inspector.
    Jerry

  • Char. formats(Bold, Underline) in Long text editor not visible in ABAP WD

    Hi ABAP experts,
    Problem:
    I have created long text with using bold and under line formats in long text editor (FM TEXT_ EDIT). I am trying to show same text in WebDynpro using READ_TEXT FM. But FM READ_TEXT is getting long text with HTML tags as shown below for bold and underline and it long text showed as same in WebDynpro application with HTML tags.
    Long text shown in webdynpro:
    Type your message using the form below. When finished, you can
    optionally preview your post by clicking on the <H>"Preview"</> tab.
    Otherwise, click the <U><H>"Post Message"</></> button to submit your
    message immediately.
    Is there any function module available to change format and pass to WebDynpro context?
    Thanks
    Rajesh Yadla

    The normal text editor in Web Dynpro won't handle HTML tags (they get safe encoded as you described).  In NetWeaver 7.01 we do introduce a FormattedTextEditor that allows for such formatting. There are APIs to convert from SAPScript based texts to the XHTML FormattedText tags.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/44/2772f505605447e10000000a422035/frameset.htm

  • JLabel updating text

    Hi,
    I have a panel called BottomPanel that is used in three frames.
    The same instance of BottomPanel is always used.
    I want the BottomPanel to do the following, every 10 seconds to change the text of a JLabel to "current time is XX".
    The issue I have is that when the JLabels.setText is invoked within the panel with the new text is not be shown in the panel.
    I have tried calling revaliate and repaint and no luck.
    I want the panel to handle this itself as it will be called from a number of frames.
    A BottomPanelManager is called by the frames to get the BottomPanel (always the same instance).
    Any help would be much appreciated
    Cheers

    You need to emulate Swing by creating a non-GUI model object to underlie the logic of this JPanel. Then create 3 new JPanels and have them all share the same model.
    edit: for instance:
    BottomPanelModel.java
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.text.SimpleDateFormat;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.List;
    import javax.swing.Timer;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class BottomPanelModel
      private static final int DELAY = 1000;
      private SimpleDateFormat sdFormat = new SimpleDateFormat("hh:mm:ss a");
      private int delay = DELAY;
      private Timer swingTimer = new Timer(delay, new TimerListener());
      private List<ChangeListener> changeListenerList = new ArrayList<ChangeListener>();
      public BottomPanelModel(int delay)
        this.delay = delay;
        swingTimer.setDelay(delay);
        swingTimer.start();
      public BottomPanelModel()
        this(DELAY);
      public void addChangeListener(ChangeListener cl)
        changeListenerList.add(cl);
      public String getTimeString()
        Date date = new Date(System.currentTimeMillis());
        return sdFormat.format(date);
      private class TimerListener implements ActionListener
        public void actionPerformed(ActionEvent arg0)
          ChangeEvent changeEvent = new ChangeEvent(BottomPanelModel.this);
          for (ChangeListener listener : changeListenerList)
            listener.stateChanged(changeEvent);
    }BottomPanel.java
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class BottomPanel extends JPanel
      private BottomPanelModel model;
      private JLabel timeLabel = new JLabel();
      public BottomPanel(BottomPanelModel model)
        this.model = model;
        add(timeLabel);
        model.addChangeListener(new ChangeListener()
          public void stateChanged(ChangeEvent arg0)
            timeLabel.setText(BottomPanel.this.model.getTimeString());
    }BottomPanelTest.java
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class BottomPanelTest
      private static final Dimension MAIN_SIZE = new Dimension(400, 600);
      private static final int BOTTOM_COUNT = 8;
      private JPanel mainPanel = new JPanel();
      public BottomPanelTest()
        mainPanel.setLayout(new GridLayout(0, 1));
        mainPanel.setPreferredSize(MAIN_SIZE);
        BottomPanelModel bpModel = new BottomPanelModel();
        for (int i = 0; i < BOTTOM_COUNT; i++)
          BottomPanel bPanel = new BottomPanel(bpModel);
          mainPanel.add(bPanel);
      public JComponent getPanel()
        return mainPanel;
      private static void createAndShowGUI()
        JFrame frame = new JFrame("BottomPanelTest Application");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new BottomPanelTest().getPanel());
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args)
        javax.swing.SwingUtilities.invokeLater(new Runnable()
          public void run()
            createAndShowGUI();
    }Edited by: Encephalopathic on Jan 12, 2009 3:24 PM

Maybe you are looking for

  • How to restrict manual changing of free goods in sales order

    Hi , Goodmorning , We have some requirement : In sales order free goods quantity determination by system  should not be allowed to change manually , where can we do this ? Looking for your inputs Thanks and regards Venkat

  • Using a view-object as a data web bean?

    Hi, When writing JSP pages, I'd like to have a web bean that allows basic data manipulation such as: - set up a row set - e.g. by specifying a view object and an (optional) where clause; - navigate this row set (first, next, etc.); - get or set the v

  • Unit of measure issue

    Dear friends, issue : for Unit of measure EA , decimal is allowed. i.e in sales order or PO system will allow 10.334 EA . I need it without Decimal. issue resolution status: I have maintained NO decimal in T code CUNI for UOM EA. But till  sytem allo

  • APEX Database migration from HP-UX to Linux

    Hi, we are migrating database from oracle 10.2.0.3 on HP-UX to 10.2.0.4 on Linux. We have Apex 3.1.2.00.02 installed in 10.2.0.3. Could anyone please provide me any checklist or relevant documentations to migrate database which contains APEX. we are

  • Apple TV video streaming

    Hi, I don't realy understand the apple tv. What can i do with it? Streaming videos from my Imac? Listen to music? /Felix