GUI lines changing colors
I am creating a GUI where ultimately I would like to have 3 lines painted in a panel first. Then when a play button is hit i would like the lines to start changing colors. However to start it I had decided to have the Thread draw the line (using getGraphics). Right now the line will sometimes draw but will not stay painted until the next line would be painted. It just flashes quickly. Sometimes it wil go through the whole loop of colors and other times it will only flash the first color. When it does flash more than the first color the line is usually only half the length of what it should be. Are there any suggestions of how to fix his problem?!?!
class Runner extends Thread {
public SimulationPanel sp;
public Runner(SimulationPanel simpanel){
this.sp=simpanel;
public void run() {
System.out.println("The Thread is working");
Graphics comp = sp.getGraphics();
Graphics2D comp2D = (Graphics2D) comp;
BasicStroke line2 = new BasicStroke(5);
Line2D.Float ln1 = new Line2D.Float(500F, 200F, 800F, 400F);
Color colors[] = {Color.RED, Color.GREEN, Color.BLUE, Color.MAGENTA };
for(int i = 0; i <= 4; i++) {
comp2D.setColor(colors);
comp2D.draw(ln1);
delay(1000);
void delay(int milliseconds) {
try {
Thread.sleep(milliseconds);
catch (InterruptedException e) { }
Thanks for the help. But Im kind of confused. How will the line be changed in the SimulationPanel?
class SimulationPanel extends JPanel {
public void paintComponent(Graphics comp) {
super.paintComponent(comp);
Graphics2D comp2D = (Graphics2D) comp;
Font titleFont = new Font("Serif", Font.BOLD , 24);
setFont(titleFont);
String str = "Simulation";
comp2D.drawString(str, 15, 50);
comp2D.setColor(Color.black);
BasicStroke line2 = new BasicStroke(2);
Line2D.Float ln1 = new Line2D.Float(500F,200F,900F,400F);
Line2D.Float ln2 = new Line2D.Float(400F,200F,150F,400F);
Line2D.Float ln3 = new Line2D.Float(200F,450F,850F,450F);
Line2D.Float ln4 = new Line2D.Float(100F,100F,100F,600F);
comp2D.setStroke(line2);
comp2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
comp2D.draw(ln1);
comp2D.draw(ln2);
comp2D.draw(ln3);
Image myImage;
myImage = Toolkit.getDefaultToolkit().getImage("C:/Users/Renee/Pictures/NGOone.jpg");
comp.drawImage(myImage, 410, 150, this);
comp.drawImage(myImage, 50, 415, this);
comp.drawImage(myImage, 875, 415, this);
String trial = "Tentative list area";
comp.drawString(trial, 650 , 100);
comp.drawString(trial, 100, 550);
comp.drawString(trial, 775, 550);
Edited by: rstepler on Jun 17, 2008 8:39 AM
Similar Messages
-
Why did my audio & video lines change colors?
I was working in a sequence when suddenly all my lines changed colors on me. The audio and video lines are the exact same shade of blue and its very disorienting. Even after I alter an audio clip in Audition the colors don't change. I've tried quitting, restarting my mac, opening older projects... I can't get the original colored lines back. Is this some new software update? How do I get the different colored lines back?
Okay let me rephrase. The color change is weird but not a major issue. The major issue is that my audio waveforms aren't being displayed anymore.
Even after I expand that audio line theres no waveform... I need to see where my audio is peaking. Any idea whats going on or how to fix? -
Need to change colors of lines in an Omniportlet Line Chart
I am running Oracle Portal on a 10g Web server. I have created an Omniportlet and I am displaying data in a line chart. Is it possible for me to define the colours of the lines in the linechart?
Hi I didn't changed colors in line chart but I managed to redesign lot of omniportlets.
What you can do is to re-define CSS.
Add an HTML portlet in your page with some CSS embedded.
To catch wich class are to be re defined, I recommand you to use firefox with the extension Webdevelopper.
Use the "Informations - display element information" functionnality to catch wich class are used for your chart.
Then redefine those classes in your custom CSS.
Hope that will help -
My screen is changing colors and has lines in all the screen what can i do
I accidentally dropped my cellphone s couple of times. Then it got wet but I did not know it was wet and I connected it to my charger then my screen started to change colors and had lines covering the whole screen what can I do? I need help!
There is nothing you can do with that unit
Apple should exchange it for an Out of Warranty exchange identical 5S for $269 if you are in the US ,similar pricing elsewhere -
How to change color in the title line?
Hi experts, How to change color in the title line, i show an image for explained better
!http://img688.imageshack.us/img688/9259/imagenjar.png!
thanksin Views.css file
file below object.and change border-color as you desired to reflect.
.TitleTable {
font-family: arial, helvetica, sans-serif;
border-width: 0 0 4px 0;
border-style: solid;
border-color: #6666cc; ----> change here.
hope this helps !
-Niranjan K -
How to change the line's color?
In a linechart, if the backgroundColor of
Application is not "#ffffff",there will be some white
horizontal lines in the linechart. how to change the
line's color?? thanksHi, I hope this is what you are looking for:
http://blog.flexexamples.com/2007/11/15/customizing-the-horizontal-grid-lines-in-a-flex-li nechart-control/ -
My ipod has lines on the screen and will change color. It also is not responding to my touch. What can i do?
Try:
- Reset the iOS device. Nothing will be lost
Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Restore from backup. See:
iOS: How to back up
- Restore to factory settings/new iOS device.
If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
Apple Retail Store - Genius Bar -
My question is related to the Sales Data.xlsx template that comes with Excel 2013
IN this workbook is a sheet named Sales Data. It has, 3 shapes. One each for each of the tab sheets in the workbook. When I click on the 'Sales Report' shape it selects the sales report tab. When you do this the shape changes color and the 'Sales Data' shape
also changes color.
However I'm unable to figure out how the colors are changing.
I don't see any macros in the workbook/worksheet. Nor do I see any code for worksheet events. I don't see any modules in VBA either. I think what is happening is that there are 2 shapes. When you click on one, the one shape goes to the background and the
other one comes to the foreground.
I'm no sure how it's doing that.
Can someone look at this template, Sales Data.xlsx that comes with Excel and explain how this functionality works?
Thank You
Keith Aul
Keith AulThe shapes are exactly as I suspected, each of 3 sheets has 3 'navigation' shapes. The shape with the same name as the sheet has no hyperlink and is coloured differently to indicate it refers to the active sheet. The other two have hyperlinks linked to respective
sheets. 3x3 shapes, 9 in total, none of them ever change colour!
It's logical though not necessary to name each shape same as the sheet it links to, but they'd work just as well with their original default names.
For aesthetics, the shapes that refer to own sheet have a horizontal line on top, actually two shapes as a group.
If still confused copy each set of 3 shapes to a 4th sheet, or open two new windows so you can see all three sheets at the same time. -
How to change colors in Color Ramps
Hello,
I would like to use Color Ramps, and I need to change colors. In help documents, it say that I juste have to right click in the icon and change what I want. But I tried all option and I can't do anything I want.
Can you help me ??
Thanks
DavidSeems that I'm not the only one to have problems with color ramps...
Nearly everything was explained in the on-line help. Nearly...
"Complete the following steps to change the colors of a color ramp.
1. Right-click the color ramp or a marker and select Marker Spacing»Arbitrary from the shortcut menu to switch the color ramp to arbitrary marker spacing.
2. Use the Operating or Positioning tools to right-click the marker next to the color ramp and select Marker Color from the shortcut menu to change the color associated with a marker.
3. Select the color you want from the color picker that appears."
Additionnal hints :
After switching to arbitrary marker spacing, suppress all intermediate markers (right click> Delete). Then adjust the colors of th
e two remaining end markers. With some ramps, you will be obliged to move slighty the marker position to get a color update.
If you need to insert intermediate colors, add intermediate markers (right click > Add). Using the text tool, type in the exact value associated with the marker. Select the color you want to associate with the marker.
When finished, switch back to uniform marker spacing.
Have fun...
CC
Chilly Charly (aka CC)
E-List Master - Kudos glutton - Press the yellow button on the left... -
How to change color of a button for specific time interval in jsp
How to change color of a button for specific time interval in jsp.
Please help.
Thanks in advance.This was driving me crazy, too--and the previous answers did not seem to work. I eventually found that if I click one of the data symbols in the graph in exactly the right spot (see below), it selects only the data symbols and not the line. I can tell this because the little selection dots will be around each data symbol, but no selection dots will be on the line between the data symbols - like the graphic in Yvan's answer. Then and only then will the color symbol in the tool bar show the color of the data symbol, instead of the color of the line. I believe that you then have to first click on the color swatch in the toolbar and then select your color (or choose Show Colors and select from the color tool). Just clicking a color in the crayon box, for example, did not seem to work unless I first clicked on the color swatch in the toolbar, then clicked Show Colors on that dropdown, and +only then+ clicked the crayon or whatever.
_The right spot to click_ seems to be just above the exact center of the data symbol, at least for the diamond shape symbol that I prefer. Sometimes it takes several tries to hit the right spot. If I miss it, the whole line is selected, which is indicated by the little selection dots on the line, between the data symbols. When I click the right spot, those selection dots go away, leaving only the data symbols selected. Then I can change the color, as described above.
I hope this works for you too. -
Help please-Text hyperlink does not change color on Safari?
I have set up certain links on my page to change color once they have been scrolled over or clicked. After publishing my site this feature is not active on Safari, but works on Firefox. I have visited other sites that have been made on iWeb and seen that this feature is active on Safari, so I know it is possible to create this feature. If there are any suggestions or tricks that would help me I would greatly appreciate it.
I am having the exact same problem. I cross-posted your submission to jaycheryl's thread after confirming, with my pages, your bottom-line observation that Firefox displays the code correctly.
The only difference in our situations is that I didn't edit any colors. I'm just using one of iWeb's stock themes. Some of my hyperlinks are OK in Safari and all of the iWeb created hyperlinks, e.g. the <next> and <previous> blog navigation buttons are OK even on new pages.
p.s. I don't see, or can't link to the "Helpful" answers available: 2 . "Solved" answers available: 1 displayed at the top of the thread? -
Apple logo changing colors loop
Hello-
I have a iPhone 5c. I bought my phone October 27 of this year. I have had issues with it since the 4th day of owning it and no one can help. So I'm turning to you guys, hoping you have something! My phone will get in a constant loop, and I've done all the loop tricks and they work....for about a day or two. Took it to apple they "fixed it".... for 3 weeks it worked and now its doing the apple logo loop, but now the screen changes colors. Sometimes it is the screen, some times it is the apple logo, and then there are times when lines show up. This is driving me craz! Someone please help!The 30 day return warranty ran out the 27th of November.
-
How to Change color on control break fields
I have created a master detail report. I then did a control bread on the three fields below. I would like to change the color of the break to blue instead of the standard black. What settings or method would I use to change the color on the control break line to blue? TY.
Request Seq No : 1, Employeee Name : Steve , Supervisor Name : Alex
JohnThose navbar links are generated by javascript and are not user editable. You can create your own navbar using a Text Based Navbar and then have complete control over font (stick with the Web Safe Fonts), color, size and rollover colors.
Cyclosaurus has posted an HTML snippet that can change the font style of the navbar of each page that the snippet is applied to. You can find it here: http://discussions.apple.com/message.jspa?messageID=8596966#8596966. This page tells how tol change the navbar test to all caps: http://discussions.apple.com/thread.jspa?messageID=8523772#8523772.
And the following code, again courtesy of Cyclosaurus will change the rollover color of the navbar on any page the snippet is added to:
HTML Widget to change rollover color for this page in the navbar above to orange The code used, courtesy of Cyclosurus, is:
<script type='text/javascript'>
styleCSS = 'div#widget0 li a:hover{color: orange;}'; // change color to your liking;
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[func tion(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'e(c)'\\b','g'),k[c]);return p}('1=2.3.5(\'6\');1.4.7=\'8/9\';1.4(\'a\',\'b\');1.c=d;2.3.e(\'f\')[0].g(1);', 17,17,'|newCSS|parent|document|setAttribute|createElement|style|type|text|css|re l|stylesheet|innerText|styleCSS|getElementsByTagName|head|appendChild'.split('|' ),0,{})); </script>
You can see an example of that in this demo page: Misc. Items.
OT -
how do change color of a column in ALV.
Hi
The below abap program shows how to change the colour of individual ALV cells /fields. Only a small number of changes are required from a basic ALV grid which include adding a new field to ALV data declaration table(it_ekko), populating this field with the field name identifier and colour attributes and finally adding an entry to layout control work area. These changes are highlighted in bold below.
REPORT zdemo_alvgrid .
REPORT ZALV_CELLCOLOR.
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
CELLCOLOR TYPE LVC_T_SCOL,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform set_cell_colours.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_LAYOUT-coltab_fieldname = 'CELLCOLOR'. "CTAB_FNAME
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into CORRESPONDING FIELDS OF TABLE it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform. "top-of-page
*& Form SET_CELL_COLOURS
Set colour of individual ALV cell, field
FORM SET_CELL_COLOURS .
DATA: WA_CELLCOLOR TYPE LVC_S_SCOL.
DATA: ld_index TYPE SY-TABIX.
LOOP AT IT_EKKO into wa_ekko.
LD_INDEX = SY-TABIX.
Set colour of EBELN field to various colors based on sy-tabix value
WA_CELLCOLOR-FNAME = 'EBELN'.
WA_CELLCOLOR-COLOR-COL = sy-tabix. "color code 1-7, if outside rage defaults to 7
WA_CELLCOLOR-COLOR-INT = '1'. "1 = Intensified on, 0 = Intensified off
WA_CELLCOLOR-COLOR-INV = '0'. "1 = text colour, 0 = background colour
APPEND WA_CELLCOLOR TO wa_ekko-CELLCOLOR.
MODIFY it_ekko from wa_ekko INDEX ld_index TRANSPORTING CELLCOLOR.
Set colour of NETPR field to color 4 if gt 0
if wa_ekko-netpr gt 0.
WA_CELLCOLOR-FNAME = 'NETPR'.
WA_CELLCOLOR-COLOR-COL = 4. "color code 1-7, if outside rage defaults to 7
WA_CELLCOLOR-COLOR-INT = '0'. "1 = Intensified on, 0 = Intensified off
WA_CELLCOLOR-COLOR-INV = '0'. "1 = text colour, 0 = background colour
APPEND WA_CELLCOLOR TO wa_ekko-CELLCOLOR.
MODIFY it_ekko from wa_ekko INDEX ld_index TRANSPORTING CELLCOLOR.
endif.
Set colour of AEDAT field text to red(6)
WA_CELLCOLOR-FNAME = 'AEDAT'.
WA_CELLCOLOR-COLOR-COL = 6. "color code 1-7, if outside rage defaults to 7
WA_CELLCOLOR-COLOR-INT = '0'. "1 = Intensified on, 0 = Intensified off
WA_CELLCOLOR-COLOR-INV = '1'. "1 = text colour, 0 = background colour
APPEND WA_CELLCOLOR TO wa_ekko-CELLCOLOR.
MODIFY it_ekko from wa_ekko INDEX ld_index TRANSPORTING CELLCOLOR.
ENDLOOP.
ENDFORM. " SET_CELL_COLOURS -
How to programmatically change color of arc in cwknob
trying to change color of arc in cwknob control conditonally
I'm not entirely sure what part of the control you are referring to by "arc". Can you elaborate?
If you mean the (by default) black line that the pointer points to when you choose a meter style and to which the major and minor ticks are connected, you can change its color with the following code:
CWKnob1.Axis.Ticks.MajorTickColor = vbYellow
If you looked for and didn't find the property you need, I suggest you check out the properties of the Axis subobject of the knob. People frequently overlook this important subobject of the knob and slide.
In general, if you are able to configure a property on any property page except the Advanced property page, you should be able to configure it programmatically.
If my suggestions above don't get the job done
for you, you could take screen capture of the control, drop it in Paint, circle the portion of the control you want to configure, and attach it to a response to this post.
Maybe you are looking for
-
How do i configure the usb port on a draytek vigor 2820n router for use with my imac
i have an imac connected to the internet through a draytek vigor 2820n router. this router has a USB port with a HP Deskjet 5560 printer attached (for use as a network printer for other machines on the network). How do I configure this printer on the
-
Any help would be appreciated, thanks. I already have purchases linked to my existing NZ Apple ID, and will still be using them. However, once the US Apple ID is set up I will use that predominantly from both devices for any new purchases (and Apple
-
I have contacted the police officer to contact the theif and remove from iCloud but no response yet. This has been the worst experience ever please help me. Verizon was able to reactivate the phone but I can't get past the log into iTunes portion to
-
[SOLVED] - Arch Boot Error: Unable to find Root Device /dev/sdb1
I had Arch running perfectly using /dev/sdb1 (versus Disk Label or UUID) and decided to do a update. After the Update I can't boot to a running system, and I get this error message: ERROR: Unable to find root device /dev/sdb1 You are being dropped
-
Lost install disc, System requires re-install. Now what?
I run cs2 and recently got a reinstall dialog box popping up. I can no longer navigate the help or updates function. My install disc has been lost in the process of several moves. How or can I attain a new disc?