Can you set the color of a specific element in a JList?

Is it possible to set the color of a single element in a JList without writing lines and lines of your own class? I know setForgroundColor exists, it just changes all element in a JList, so is there a simple way to tweak it? i am still a newbie, so re-writing swing, would be a bit of a problem for me. Any Suggestions? thanks.

you write your own renderer, about 6-8 lines, setting the color determined by an
if/else statement - note: you must set the color in both if and else
search the forums for
"implements ListCellRenderer"
and you should find plenty of examples
if you just want the selected element a different color, you can do this with
UIManager.put("List.selectionBackground", new javax.swing.plaf.ColorUIResource(Color.YELLOW));
but you must do this before you create the JList, and it will affect all JLists in your program.

Similar Messages

  • Using MS Access Web App, can you set the tab order of the fields on a form?

    Using MS Access Web App, can you set the tab order of the fields on a form?  Doesn't appear to be a property.  I don't see a programmatic method.  I saw someone suggest using goto control on the after update event trigger but what if the person
    doesn't edit the field?  No event would be fired.
    Jim

    Hi Jim,
    >>Using MS Access Web App, can you set the tab order of the fields on a form?
    I am afraid you could not. In Web applications, the tab order is set automatically and cannot be changed.
    (From
    https://support.office.com/en-au/article/Set-the-tab-order-for-controls-3d7f749c-5a53-42b2-bb0e-2323fa044e2e)
    >> I saw someone suggest using goto control on the after update event trigger but what if the person doesn't edit the field?  No event would be fired.
    The goto method is a workaround, but it should be triggered by a specific event. What I can figure out is changing the order of the fields.
    If this is a feature you want to include in future versions of Access Web app, please submit a feedback as the picture below:
    Best Regards,
    Edward
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can you set the max row for a 'open cursor' in a stored proc?

    I would like to know how can you set the maximum amount of row returned in a resultset coming from a stored proc?
    You can do it via JDBC with cStatement.setMaxRows(10); but it works only for select that you do via JDBC...
    I would like the same functionality using open cursor inside a stored proc...
    Thanks...

    is "where ROWNUM <= 10" the equivalent of "cStatement.setMaxRows(10);" because the ROWNUM as problem with the ORDER BY clause and the setMaxRows() as no problem...

  • Can you set the i pod to play albums one after the other as it seems to stop once its played the one album!! :-(

    can you set the i pod to play albums one after the other as it seems to stop once its played the one album!! :-( thanks

    Unfortunately that is the way the interface is designed. If you select an album from the albums menu, then it plays an album, optionally shuffled and/or repeated. If you select from the artists menu then you should be able to shuffle the albums or songs by that artist or have them played in sequence, again with options to repeat. You can also cue up a number of songs or albums with the On-the-Go playlist feature.
    iPod classic manual
    tt2

  • Can you set the Duration of a Transition to instant? Or Remove a previous?

    Can you set the duration of a Transition to instant? (Rotate and Translate).
    Or if not, remove a previous transition done? (Reset the transitioned object back to its original). Ihave tried setting Duration.millus(.000001), but I can still see it translate/rotate. if I set it to zero, it doesn't do anything at all.
    Goal:
    I have a Connect4 type grid that Flips. It rotates upside down 180degrees, the pieces 'fall' down. Then I ACTUALLY flip the game board (not just effects) using a matrix calculation. But since my grid is upside down, my pieces appear upside down.
    So here is the method I was thinking:
    -Flip the board upside down
    -Translate the pieces down (gravity)
    -Actually flip the game board's internals and positions.
    -Undo the previous rotate/translate so the user thinks the 'animation' actually flipped the board.

    You cannot create an instant Transition. An Animation with a duration of 0ms is considered invalid and does not do anything when play() is called.
    Why do you have to use Transitions to set the values? They just modify Node properties over time, if you want to change the properties instantly, you can just access them directly. TranslateTransition modifies translateX, translateY, and translateZ, RotateTransition modifies rotate and rotationAxis.

  • Can you change the color of the page?

    Can you change the color of the page using In Design CS5.5 ?
    How?

    Are you intending to print a color onto the page to change the color or perhaps you need a colored background for onscreen output? Or are you planning on printing on already-colored stock?
    For the former, use Scott's suggestion, for the latter edit the Paper swatch.

  • Can you edit the color of the bottom play bar on a slide once you assign the cpCmndShowPlaybar to 0

    Can you edit the color of the bottom play bar  on a slide once you assign the cpCmndShowPlaybar to 0. When I assign the slide this action it shows a grey shape at the bottom hiding the playbar controls, but I would like to make that color white to blend in with the white background on my webpage. How do you change the color?

    It is not possible to change the border color by an (advanced) action, sorry. If you do not mind, you could choose the white color for the bottom border from the start. When the playbar is showing, provided it it stretched, it will cover up this bottom border.
    Lilybiri

  • Can you disable the color picker in code view?

    One of the  things that slows me down in Dreamweaver is the color picker in code view. it pops up when I'm trying to type a quick colour - like #fff, and causes a pause in my system for 5 seconds (effectively locking up my system) while it thinks about selecting a color. is there a way I can just stop the color picker from popping up at all? I never use it to pick colors.

    There is no way to disable the colour picker in Code view. However, you can successfully prevent it from popping up by changing the delay in Preferences:
    Setting the delay affects all code hints, but they pop up as soon as you start typing. However, I found that a delay of about 1 second was sufficient to suppress the colour picker.

  • Can you set the print margins in Preview?

    Simple question: Is there a way to set the print margins when printing an image from Preview?
    Thanks,
    -ME

    EagleSongs wrote:
    I can set margins in other programs (like Photoshop, Word, Excel, Firefox, Chrome...), but there does not seem to be a setting for margins when printing from Preview. I don't want to resize the image, just get it to print in a certain position on the paper (template form).
    In the case of Photoshop, you are placing an image on a canvas and can position the image to suit. Word and Excel have a Page Setup menu that lets you set the margin positions - which know since you have got the output you wanted. There is no Page Setup menu for most, if not all, Apple applications like Preview. Instead parts of the Page Setup menu have been added to the print dialog but margins is not one of them.
    EagleSongs wrote:
    However, I was trying to find a way to print from Preview and get it to position the image on the page the way I want.
    Understood. Unfortunately you don't get that option in Preview. The image will be centred - both horizontal and vertical - based on the paper size and the printer you have selected in the print dialog. You could create a custom paper size with the margins you want to position the image and then use that custom paper in Preview. But your workaround of using Word gives you more control over the positioning of the image.

  • How can I set the color for a textfield

    Hi all,
    I use a textfield and I want to set the color for characters which are typed in the textfield. I didn't find anywhere a solution for this. Do you know how I should implement this?
    Thanks

    Not possible. If you want this, you'll need to make a custonItem that implements this.

  • Can you set a ringtone for a specific person calling?

    Can you set a ringtone on your phone for different people?

    Yes.
    Open the contact in the Contacts app, tap Edit and set the Ringtone under the Ringtone section.

  • How can you set the ctxsvr time interval ?

    I would like to know how can i set the time
    inteval between each update of the Intermadia
    indexes.
    Thanks.

    stop and restart ctxsrv on specified intervals.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Lombar vincent ([email protected]):
    I'd like to use the ctxsrv utility, because i want automatic index rebuild.
    But Is it possible to set the time interval
    between each update?<HR></BLOCKQUOTE>
    null

  • Can you change the color of a Generator background?

    Dumb question, but how do you change the color of a Generator background?
    Not seeing the option in the inspector.

    On that note, I want to correct my earlier post saying that you'd have to go to Motion if there was no published parameter to adjust the color of the generator. 
    Nothing would stop you from adding a Colorize filter directly in FCP X.
    Of course, if there was more to the generator than just a background, the Colorize effect would impact all parts of the Generator, whereas in Motion you'd have the ability to isolate the particular layer you want to affect. 
    The main reason to go to Motion in this changing the generator color scenario would be to publish the Shape Color(if the background was a shape) or publish the Colorize filter(both remap white and black) so that you could easily modify the color of any future instance of that Generator copy.  

  • How can I set the width of a Text element?

    Hello! I have created a custom button with this class:
    import javafx.scene.Node;
    import javafx.scene.CustomNode;
    import javafx.scene.Group;
    import javafx.scene.Cursor;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.paint.Color;
    import javafx.scene.paint.LinearGradient;
    import javafx.scene.paint.Stop;
    import javafx.scene.effect.DropShadow;
    import javafx.scene.text.Text;
    import javafx.scene.input.MouseEvent;
    public class Button extends CustomNode {
        public var text: String;
        public var x: Integer = 0;
        public var y: Integer = 0;
        public var width: Integer = 90;
        var height: Integer = 25;
        override public function create(): Node {
            return Group {
                content: [
                    Rectangle {
                        cursor: Cursor.HAND;
                        x: this.x;
                        y: this.y
                        width: this.width;
                        height: this.height;
                        arcWidth: 15;
                        arcHeight: 15;
                        effect: DropShadow {radius: 6};
                        fill: LinearGradient {
                            startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                            stops: [
                                Stop {offset: 0.0, color: Color.WHITE}
                                Stop {offset: 1.0, color: Color.LIGHTGRAY}
                        onMouseEntered: function(e: MouseEvent): Void {
                            (e.node as Rectangle).fill = LinearGradient {
                                startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                                stops: [
                                    Stop {offset: 0.2, color: Color.WHITE}
                                    Stop {offset: 1.0, color: Color.LIGHTGRAY}
                        onMouseExited: function(e: MouseEvent): Void {
                            (e.node as Rectangle).fill = LinearGradient {
                                startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                                stops: [
                                    Stop {offset: 0.0, color: Color.WHITE}
                                    Stop {offset: 1.0, color: Color.LIGHTGRAY}
                        onMousePressed: function(e: MouseEvent): Void {
                            (e.node as Rectangle).fill = LinearGradient {
                                startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                                stops: [
                                    Stop {offset: 0.0, color: Color.LIGHTGRAY}
                                    Stop {offset: 1.0, color: Color.WHITE}
                        onMouseReleased: function(e: MouseEvent): Void {
                            (e.node as Rectangle).fill = LinearGradient {
                                startX: 0.0, startY: 0.0, endX: 0.0, endY: 1.0
                                stops: [
                                    Stop {offset: 0.0, color: Color.WHITE}
                                    Stop {offset: 1.0, color: Color.LIGHTGRAY}
                    Text {
                        x: this.x + 5, y: this.y + 16
                        content: this.text
    }But, how can I set the Text element centered into the button?

    Stack {
                        layoutInfo: LayoutInfo {
                            width: bind width;
                            height: bind height;
                        content: [Rectangle {
                                width: bind width, height: bind height
                                //fill: bind color;
                                fill: Color.GREEN
                                arcHeight: 20; arcWidth: 20;
                            Text {
                                font: Font {
                                    size: 24
                                textAlignment: TextAlignment.CENTER;
                                wrappingWidth: width;
                                boundsType: TextBoundsType.VISUAL;
                                fill: Color.WHITE;
                                content: bind text;
                    }wrappingWidth: Sets the maximun width of the text
    boundsType: If you put the wrappingWidth var and you want to center a text you MUST set this var to VISUAL

  • Can you set the type of alert in iCal on the iPad?

    I have an iPad (1st generation) with the latest iOS5. I love the new iOS and especially the way that iCloud makes things more seamless between my devices. I do have an issue with iCal, however. When I set an event in iCal in OSX, I can set the alert to be a message, message with sound, email, etc. By default, if I set an event in iCal on my iPad the alert is a message. I can find no way to change this. If there is a way, please tell me.
    Because of this, I never use iCal on iPad to set alerts because I like to use message with sound. This greatly reduces the functionality of iCal on iPad because, for me, it can only be used as a calendar event viewer. Any help would be appreciated. Note: I have contacted apple feedback about this issue.
    In a related, but less important issue, I find that the settings for the timing of the alert are very limited in iCal on iPad. On iCal in OSX one can set the alert time for either the time of the event, or pretty much any amount of time prior to the event. On the iPad, iCal will only let you set it to the day of the event, 1 or 2 days before, or 1 week before the event. A limitation, but not crippling. However, if anyone knows how to set the timing of the event on iPad's iCal with more specificity I would really like to know.
    Thanks!

    Under Settings, Sounds, you can set an alert sound for calendar events.
    For timed events, you can set the alert for a range of times from 5 minutes before upwards (e.g.15 mins, 30 mins, 1 hour). For all-day events, the range is as you described.
    You can set the alert for each event as you create it (or edit it later)
    You can set default alerts for all-day event,s timed events, and birthdays (i.e. different defaults for each type) in Settings, Mail, Contacts and Calendar, default Alerts.
    Does that help?

Maybe you are looking for

  • Strange behavior when creating a document with an "html" node

    A strange thing is happening here. I'm using the javax.xml.transform.Transformer to save some XML documents. I can create documents with any arbitrary DOM tree I want, but if I have the root node have a name of "html". somehow the Transformer decides

  • Dual 2.3 G5 PPC won't connect to airport express...

    This one is boggling my mind. I'm a pretty technically savvy guy but I have ran out of options and ideas. I had a very unstable "dlink router" based network consisting of my G5 Dual 2.3 PPC Tower, a Powerbook G4 1.33, New Dell Laptop (work pc) and 3

  • Error: No address found for partner function type Ship-To Address

    Hi All, I am working in SRM 5.0(patch level1) and for PDP scenario When I am creating service PR in R/3 with two header items and each header item has only one below line item (service item), then it transfer in SRM properly. But if I am maintaning m

  • Change the source for a media player based on selection from a list.

    All of this is referring to my public facing website in Office 365. I put the following code in a content editor web part: <audio controls>   <source src="http://someserver/somefile.mp3" type="audio/mpeg"> </audio> This works just fine.  What I want

  • General stuff for macbook pro 13inch 2014

    hi recently brought a macbook pro from curries in blackburn lancashire and i thought the battery life is ment to be like 9 hours but oh no its not even so its took me few days to do software updates cos the battery life is like 4 hours n 20 mins so i