Generating rectangle with Timer
hi,
I am trying to 'paint' a shape say a rectangle using the paintcomponent using a timer that will paint every 12 seconds
class Timerclass implements ActionListener {
public void actionPerformed(ActionEvent e) {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.fillRect(90,325,20,20);
}the above doesnt work...any ideas?
import java.awt.Color;
import java.awt.Graphics2D;
public class vehicle {
private static final int size = 20;
private Color vehicleColor;
private int Xvehicle, Yvehicle, speedVehicle;
public vehicle(int x, int y, int velocity) {
vehicleColor = Color.BLUE;
Xvehicle = x;
Yvehicle = y;
speedVehicle = velocity;
public void drive() {
Xvehicle += speedVehicle;
public void draw(Graphics2D g2) {
g2.setColor(vehicleColor);
g2.fillRect(Xvehicle, Yvehicle, size, size);
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.Timer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Anime extends junction {
private vehicle vec_1 = new vehicle(80,365, 2);
private int a_interval = 35;
private int b_interval = 4000;
private Timer a_timer, b_timer;
public Anime() {
a_timer = new Timer(a_interval, new Timer1());
b_timer = new Timer(b_interval, new Timer2());
public void setAnimation(boolean StartStop) {
if (StartStop) {
a_timer.start();
b_timer.start();
} else {
a_timer.stop();
b_timer.stop();
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g3 = (Graphics2D) g;
vec_1.draw(g3);
class Timer1 implements ActionListener {
public void actionPerformed(ActionEvent e) {
vec_1.drive();
repaint();
class Timer2 implements ActionListener {
public void actionPerformed(ActionEvent e) {
// g = (Graphics2D)this.getGraphics();
//create new vehicle randomly...
}I tried different ideas none worked, and i am stuck on this, making new instances of vehicle class in Anime class, should i be using threads or is it not necessary?
Similar Messages
-
Problem with Time Dimension generating
Hello, everybody.
I have a problem with Time Dimension generating with the help of the Standard Wizard.
1. I choose Dimensions -> New -> Using Time Wizard
2. Set Name as "Time"
3. On the next screen I choose ROLAP: Relational Storage
4. On the next screen set Start year: 2003, Number of years: 3
5. On the next screen choose all levels of the Normal Hierarchy
On the 6-th step Wizard complete 60% of job and hang up doing nothing (buttons "Cancel" and "Help" is active).
chapter "Create REL_TIME Dimension Using the TIME Dimension Wizard", step 1-6 of tutorial =(
http://www.oracle.com/technology/obe/11gr1_owb/owb11g_update_getting_started_intro/lesson3/less3_relational.htm
My system characteristics:
Builder client 11.1.0.7.0, warehouse at local computer.
can anybody give me any advice about this problem? =(
thanks in advance.Had this issue been solved please?
I have just come across the exact same problem and this post is the only one i managed to find which describes exactly what is happening to me.
Thanks -
How can I generate a real-time highchart from my database data?
I have looked several links; however, I couldn't find a working demo showing how to implement a highchart using data from a database.
Objective: I want to generate a real time highchart line graph getting data from my database. What I want is very similar to the
HighChart Demo which provides a real-time highchart with randomly generated values. It is also similar by X-axis and Y-axis, for I want my x-axis to be "Time" (I have a DateTime column in my database) and y-axis to be an integer (I have
a variable for that as well in my database).
Please I need help in sending the model data to my razor view.
Note that I am already using SignalR to display a realtime table. I also want to know if it can be used to automatically update the highchart as well.
Below is the code snippet of my script in the view. I have used the code provided in
HighChart Demo link for generating the highchart. Please tell me where should I apply the changes on my code.
@section Scripts{
<script src="~/Scripts/jquery.signalR-2.2.0.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="~/SignalR/Hubs"></script>
<script type="text/javascript">
$(document).ready(function () {
// Declare a proxy to reference the hub.
var notifications = $.connection.dataHub;
//debugger;
// Create a function that the hub can call to broadcast messages.
notifications.client.updateMessages = function () {
getAllMessages()
// Start the connection.
$.connection.hub.start().done(function () {
alert("connection started")
getAllMessages();
}).fail(function (e) {
alert(e);
//Highchart
Highcharts.setOptions({
global: {
useUTC: false
//Fill chart
$('#container').highcharts({
chart: {
type: 'spline',
animation: Highcharts.svg, // don't animate in old IE
marginRight: 10,
events: {
load: function () {
// set up the updating of the chart each second
var series = this.series[0];
setInterval(function () {
var x = (new Date()).getTime(), // current time
y = Math.random();
series.addPoint([x, y], true, true);
}, 1000);//300000
title: {
text: 'Live random data'
xAxis: {
type: 'datetime',
tickPixelInterval: 150
yAxis: {
title: {
text: 'Value'
plotLines: [{
value: 0,
width: 1,
color: '#808080'
tooltip: {
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
Highcharts.numberFormat(this.y, 2);
legend: {
enabled: false
exporting: {
enabled: false
series: [{
name: 'Random data',
data: (function () {
// generate an array of random data
var data = [],
time = (new Date()).getTime(),
i;
for (i = -19; i <= 0; i += 1) {
data.push({
x: time + i * 1000,
y: Math.random()
return data;
function getAllMessages() {
var tbl = $('#messagesTable');
var data = @Html.Raw(JsonConvert.SerializeObject(this.Model))
$.ajax({
url: '/nurse/GetMessages',
data: {
id: data.id,
contentType: 'application/html ; charset:utf-8',
type: 'GET',
dataType: 'html'
}).success(function (result) {
tbl.empty().append(result);
$("#g_table").dataTable();
}).error(function (e) {
alert(e);
</script>Hi Sihem,
Thank you for contacting National Instruments. Using the LabVIEW Real-Time module, you can do development without actually having a target. While viewing the project explorer window, you can do the following steps:
Right click on the project
Select New >> Targets and Devices
Select the "New Target or Device" radio button
Select the target you would like to develop on.Information about the LabVIEW Real-Time Module can be found here.
Regards,
Kevin H
National Instruments
WSN/Wireless DAQ Product Support Engineer -
Limit PO - Confirmation with Time and Material
To All:
We are in SRM 7.0 - Classic Scenario and ECC 6.0 EHP4.
We implemented the use of Limit PO in SRM to enable us to create a PO for Services that will give us the Value Limit and Expected Value functionality. In our scope the Limit PO can be confirmed in SRM for Time Entries and Material(s). Unfortunately we can only enter time and if we add material by clicking Add Item dropdown and choose As Free Description. We are getting an error message Inconsistent Parameter During Method Call after we enter the item type as material and the of measure as ea.
We did not implement SUS and if we do it in ECC through ML81N transaction, we can create Service Entry Sheet with time and materials.
Any direction on how to resolve this issue is appreciated.
Thank you all very much.
MikeHi
to understand SAP design funtionality . not to solve your issue
Note 502176 - Confirmation for mixed Backend goods/service purchase order
Symptom
1. When you enter a goods/services confirmation, the system displays the same purchase order several times in the search result.
2. When you expand the service purchase order item in the search, the system displays the material items.
3. When you create a confirmation for the "material portion" of the purchase order, the system proposes the services of the first service purchase order item.
Other terms
eCommerce, Enterprise Buyer professional, EBP, BBP, B2B, BBPCF01, BBPCF02, BBPCF03, BBP_CF, SAPLBBP_CF, Backend, service
Reason and Prerequisites
You enter the confirmation for an (R/3)-Backend purchase order which contains both material items and service items.
Solution
Ad 1:The display in the search result is correct!
An entry is generated in the search result for EVERY service item. In addition, ONE other entry is generated for the total of all material items.
Background:You cannot post any mixed goods and service confirmations in the R/3 system.
Every Backend service purchase order item can include one or several service items as well as a limit, however, which are NOT broken down in the search result.Ad 2 and ad 3:Implement the attached program corrections.
Muthu -
Can't open libHaru-generated PDF with Reader, other readers work.
Our application uses libHaru to export PDF images. These PDFs can be opened using PDFlite on Windows, Preview on Mac and some other readers. However, I have tried several versions of Adobe Reader on both platforms and the files fail to open with the message: "There was an error processing a page. There was a problem reading this document (14)." So, it seams that Adobe Reader believes that there is problem with this file. However, from my very limited understanding of PDF structure, I have no idea what might be wrong, so I don't know how to fix it. The file is written unencrypted. It is about as simple a PDF as we can generate - a red-filled rectangle. I would greatly appreciate any suggestions or help.
Here is a sample PDF:
%PDF-1.3
%∑æ≠™
1 0 obj
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/Kids [ 4 0 R ]
/Count 1
>>
endobj
3 0 obj
<<
/Producer (Haru Free PDF Library 2.3.0-dev)
>>
endobj
4 0 obj
<<
/Type /Page
/MediaBox [ 0 0 236 207 ]
/Contents 5 0 R
/Resources <<
/ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
/Pattern <<
/Type /Pattern
/PatternType 1
/PaintType 2
/TilingType 2
/BBox [ 0 0 100 100 ]
/XStep 100
/YStep 100
>>
>>
/Parent 2 0 R
>>
endobj
5 0 obj
<<
/Length 6 0 R
>>
stream
1 0 0 -1 -118 296 cm
1 w
0 0 0 RG
[] 0 d
1 0.3 0.3 rg
q
% Rect
119.25 90 m
352.5 90 l
352.5 294.75 l
119.25 294.75 l
119.25 90 l
h
B
Q
endstream
endobj
6 0 obj
135
endobj
xref
0 7
0000000000 65535 f
0000000015 00000 n
0000000064 00000 n
0000000123 00000 n
0000000188 00000 n
0000000458 00000 n
0000000647 00000 n
trailer
<<
/Root 1 0 R
/Info 3 0 R
/Size 7
>>
startxref
666
%%EOFYou would need to post a sample PDF that demonstrates the problem. All you posted there is text. (PDF is a BINARY file format)
From: Adobe Forums <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Date: Thu, 13 Oct 2011 11:02:42 -0700
To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
Subject: Can't open libHaru-generated PDF with Reader, other readers work.
Can't open libHaru-generated PDF with Reader, other readers work.
created by Fred Snerd<http://forums.adobe.com/people/Fred+Snerd> in PDF Language and Specifications - View the full discussion<http://forums.adobe.com/message/3969828#3969828 -
TDS line item not generated at the time of down payment vide F-48
Dear Friends,
Uptill 2008 the system i.e. SAP ECC5 was properly generating tds line items at the time of making down payment.From Feb I,2009 suddenly noticed that no tds line items are generated at the time of making down payment to vendors.Inspite of my hard efforts I am unable to crack this problem.
Any suggestions/solutions is highly solicited.
Best Regards
Monoj
Edited by: MONOJ SARKER on May 4, 2009 5:57 PMHi Friends,
Tax type along with tax codes for invioce posting and only tax type for payment postings are updated in the vendor master.At the time of advance payment when the screen pops up for updating tax code at that point tax code for payment postings are updated.
For your in formation I would like to say uptill 2008 there was no problem in withholding tax.The problem started in early 2009.The configuration which existed during 2008 remains unchanged.Its not clear why I am unable to generate TDS line item during advance payment .
Regards
Monoj -
TDMS viewer not showing data with time stamp
Need help with time stamping data in a TDMS file generated by DAQ Assistant.
When I use the TDMS Viewer, with the x-scale set to absolute time, the date starts at 1903. If I use Excel to look at the file the start time is correct (i.e. 2013).
Solved!
Go to Solution.Bo_Xie, I have simplifed my VI and now able to display the correct time stamp. Thank for your time!
-
Less redo generates at the time of online backup using RMAN
Hi,
can someone eleborate that why less redo generates at the time of RMAN online backup in comparison of manual hotbackup.
ThanksA manual hot backup (aka "OS backup" or "scripted backup") cannot handle fractured blocks. This happens when a backup command is copying out blocks from a datafile at the same time as DBWR is updating blocks. The Oracle Block Size (8KB) is generally a multiple of the OS Block size (512Bytes to 4KB or 8KB, depending on the filesystem / raw device and how the OS command copies blocks out). It is possible for DBWR to write 8KB and the OS backup utility to be concurrently reading the same Oracle block as, say, two different 4KB reads. The first half of the Oracle block may be read by one OS call and the second half by another OS call -- the two halves would be inconsistent with each other if Oracle were writing the database block at the same time.
(Therefore a restore of such a backup would give you an inconsistent -- i.e. fractured -- block, which would be logically corrupt).
In order to handle such issues, after a BEGING BACKUP is issued, for every first change to a database block, the whole block is written to the redo stream, not just the change vectors. (If the same database block is subsequently modified while in BACKUP mode, it is only the change vectors that have to be written to the redo stream). Once the END BACKUP is issued, the redo stream does not need to capture whole database blocks.
If such a backup is restored, it still has fractured blocks. However, when applying the ArchiveLogs generated during the Backup, each such fractured block is "automagically repaired" because a whole image is restored from the ArchiveLog. (Subsequent changes are replayed as changes through the change vectors).
Hemant K Chitale
http://hemantoracledba.blogspot.com -
Exporting a movie with time code when time code doesn't exist
Title says it all. I need to export a 150 frame movie from CG rendered frames that contain no time code so that I can find which frames to re-render
I do not wish to create a time code effect. I need to generate an actual time code that will display in an exported movie.
The latter is achieved with the former.
But I would ask, why can't you just watch the timeline? Why export at all? I mean, 150 frame movie is only 5 seconds long. -
In other words jQuery mobile does not generate code with result can not test Apps in dw cs6
from the time compiled in phonegap dw c6 tools and tested from dw the App in Android sdk, for a jQuery mobile App the, code in split/Live is the same as split/Live/Live Code.... in other words jQuery mobile does not generate code with result can not test Apps in dw cs6, but design shown without jQ mobile generated code, well?
well, jQuery mobile stopped to generate code with result can not test Apps in dw cs6, but design shown without jQ mobile generated code, well (neither generated code seems nor design as seem in mobile)....????
-
Is there any way to modifiy the date picker/calendar popup (with time) to allow for different time intervals? I've gotten a request to show the minutes in 15 minute intervals rather than 1 minute intervals.
Since this is generated out of the wwv_flow_utilities package I suspect the answer is a big fat 'no', but I had to ask. Perhaps a nice little enhancement for a future version? Thanks.
EarlHi Earl,
You could ofcourse write your own date-time picker.
Another solution would be to have a date picker only for the date and build your own time dropdown lists (so instead of 1 field with date-time picker; you would have 3 fields: 1 date picker + 2 dropdown lists)
Dimitri
-- http://dgielis.blogspot.com -
Generate invoice with a different Sponsor Address
Hi all,
Is there a way to generate a grant invoice with a different mailing address for the sponsor?
The 'sponsor' will still remain the funder of the grant - only that we would like to generate invoice with a different address.
Please let me know any solutions that you may have.
Thanks.
RogerHi,
In the second tab of the BP master data, you should see 2 specific things :
1. Address Overview
2. Address Usages
Part of the address usages is the address for correspondence.
If you do not see that, maybe it is due to the BP View which is assigned to the BP role (here, the sponsor).
This is valid as from ECC 6.00
In addition to what I had previously said, you should create an additional address in the address overview, and select it as a valid address for correspondence.
If you want to activate the time dependency, check note 810634.
I hope it helps,
Helene -
Deadlock with thread issues while generating reports with Crystal Report XI
We are facing deadlock with thread issues while generating report with Crystal Report XI
Version Number is 11.0 and the database used is Oracle
In the log file on line number 74350 by 2008/12/16 13:35:54 there is a dead lock with Thread: u20184u2019 is waiting to acquire lock for 'com.crystaldecisions.reports.queryengine.av@15214b9' which is held by the Thread: '0'.
And a dead lock with Thread: u20180u2019 is waiting to acquire lock for 'com.crystaldecisions.reports.queryengine.av@15214b9' which is held by the Thread: '4'.
Exactly after 10 minutes we can see the thread 4 and 0 are declared as STUCK by 2008/12/16 13:45:54 .
Is this an existing issue with Crystal Report?
Is there some solution for this problem?
THE LOG FILE INFORMATION IS GIVEN BELOW
[deadlocked thread] [ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)':
Thread '[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'' is waiting to acquire lock 'com.crystaldecisions.reports.queryengine.av@15214b9' that is held by thread '[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)''
Stack trace:
com.crystaldecisions.reports.queryengine.av.V(Unknown Source)
com.crystaldecisions.reports.queryengine.av.do(Unknown Source)
com.crystaldecisions.reports.queryengine.as.if(Unknown Source)
com.crystaldecisions.reports.reportdefinition.datainterface.j.c(Unknown Source)
com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
com.crystaldecisions.reports.reportdefinition.cy.b(Unknown Source)
com.crystaldecisions.reports.reportdefinition.cy.long(Unknown Source)
com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
com.crystaldecisions.reports.reportdefinition.a1.a(Unknown Source)
com.crystaldecisions.reports.common.ab.a(Unknown Source)
com.crystaldecisions.reports.common.ab.if(Unknown Source)
com.crystaldecisions.reports.reportdefinition.a1.if(Unknown Source)
com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
com.crystaldecisions.reports.reportengineinterface.a.a(Unknown Source)
com.crystaldecisions.reports.reportengineinterface.a.a.b.a(Unknown Source)
com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)
com.sysarris.aris.crystalreports.RepServlet.generateReport(RepServlet.java:65)
com.sysarris.aris.crystalreports.RepServlet.doPost(RepServlet.java:40)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
[deadlocked thread] [ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)':
Thread '[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'' is waiting to acquire lock 'com.crystaldecisions.reports.queryengine.av@12e0415' that is held by thread '[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)''
Stack trace:
com.crystaldecisions.reports.queryengine.av.V(Unknown Source)
com.crystaldecisions.reports.queryengine.av.do(Unknown Source)
com.crystaldecisions.reports.queryengine.as.if(Unknown Source)
com.crystaldecisions.reports.reportdefinition.datainterface.j.c(Unknown Source)
com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
com.crystaldecisions.reports.reportdefinition.cy.b(Unknown Source)
com.crystaldecisions.reports.reportdefinition.cy.long(Unknown Source)
com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
com.crystaldecisions.reports.reportdefinition.a1.a(Unknown Source)
com.crystaldecisions.reports.common.ab.a(Unknown Source)
com.crystaldecisions.reports.common.ab.if(Unknown Source)
com.crystaldecisions.reports.reportdefinition.a1.if(Unknown Source)
com.crystaldecisions.reports.reportdefinition.a1.o(Unknown Source)
com.crystaldecisions.reports.reportengineinterface.a.a(Unknown Source)
com.crystaldecisions.reports.reportengineinterface.a.a.b.a(Unknown Source)
com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)
com.sysarris.aris.crystalreports.RepServlet.generateReport(RepServlet.java:65)
com.sysarris.aris.crystalreports.RepServlet.doPost(RepServlet.java:40)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
Can you please suggest any work around for this?I'm not referring to Servlet threading issues.
I'll clarify.
You have two threads, both entering ReportClientDocument.open(...) method.
Thread 4 is waiting to acquire 'com.crystaldecisions.reports.queryengine.av@15214b9'
Thread 0 is waiting to acquire ''com.crystaldecisions.reports.queryengine.av@12e0415'
So I'm thinking ??? are they the same objects?
My specific question concerning the ReportClientDocument is that both are calling open - i.e., trying to open a new report. You wouldn't be trying to open different reports using the same ReportClientDocument - so was wondering if you've cached the RCD and trying to open two different reports at the same time on the same instance via different threads.
You'd normally tie a ReportClientDocument instance to a HTTP Session, to ensure each user gets their own copy.
Sincerely,
Ted Ueda -
Fill a rounded rectangle with a gradient paint with "new RoundRectangle2D"?
Hello,
at the moment I have to do a lot of Java2D to draw a customized GUI. Now it comes to a simple task, filling a rounded rectangle with a gradient paint. I have a solution for this - but I don't know if it is bad to do it this way:
private void drawBackground( Component component, Graphics2D graphics2d ) {
int w = component.getWidth() - 1;
int h = component.getHeight() - 1;
graphics2d.setPaint( gradientPaint );
RoundRectangle2D backgroundShape =
new RoundRectangle2D.Float( 0, 0, w, h, 10, 10 );
graphics2d.fill( backgroundShape );
}This is very easy and it works. The backdraw is, that on every call of "drawBackground", which is called on a repaint() method by Swing, a "new RoundRectangle2D.Float" will be created. I don't know how "expensive" it is to create a new RoundRectangle2D. On the other hand, I don't know how to fill a rounded rectangle with a gradient paint without a RoundRectangle2D.
When I do it this way, I worry that at a later time, when I created a lot of custom components that all create shapes on a repaint, the GUI may become horrible slow or has a huge memory footprint.
Well, I would like to hear some kind of "this is okay" (maybe because those Shape implementation are all not very memory consuming and the instanciation in Java is not very time consuming) by you Java2D experts :) Or, of course, how I could do it better.
Thanks a lot for your help!patb1 wrote:
on every call of "drawBackground", which is called on a repaint() method by Swing, a "new RoundRectangle2D.Float" will be created. I don't know how "expensive" it is to create a new RoundRectangle2D.
When I do it this way, I worry that at a later time, when I created a lot of custom components that all create shapes on a repaint, the GUI may become horrible slow or has a huge memory footprint.You could do as many UI delegates in the Swing code do with Rectangles: maintain a RoundRectangle2D as a field and set its attributes when it is to be painted (setRoundRect(double x, double y, double w, double h, double arcw, double arch)).
db -
Generating signal with several frequencies - Timing issues
Hi
I use Labview 7.1.
I am trying to generate a signal composed of 1000 different frequencies.
For this purpose I am using the Multitone Generator VI .
My problem is that the generating process is too long for my real-time
application.
Is there any way to accelerate (optimize) this process?
I think about several options, such as:
Using more powerful computer (multicore)
Making the process parallel (is it relevant
for Labview7.1?)
Changing VI's properties (priority etc..)
Please advice
AmirHi,
Attached my problem.
I am trying to generate signal with 100 frequency component (100 different sine waves).
According to the timers it is taking 87mSec to produce the signal which length is 1 second.
In my project, I need to generate 1000 frequency components. And also 20 channel of this kind.
So it is clear that i will not be able to achieve the timing requirements
(It will take more than 1 second to generate a signal of 1 second)
What can you advise me ?
Thanks
Amir
Attachments:
Generate_100_freq_signal.jpg 156 KB
Maybe you are looking for
-
Itunes match is making itunes non responsive
Hi! Ive been looking into this issue on both the "itunes windows" and the "match" forums with no real luck. I updated my itunes, it is fully updated on all things i use. I left itunes back in Jan2013 because at that point only being able to add my de
-
SAP Script Check printing Layout, Line Items to display twice in First Page
Hi All, This requirement is for US check printing Layout. My Requirement is to display Items twice on the first page. Eg : Main Window has 10 Items, I need to display all the Items at the bottom in another window at the bottom. I can't create 2 Main
-
How to email oracle reports in pdf as attachments
Hi, I am dynamically generating pdf files from oracle reports accessed from a web application. I need to email this pdf file as an attachment. I set destype=mail, desformat=pdf or html and desname=to the email address. The email get sent with the fil
-
Mini not showing up in iTunes or charging anymore
Hello, It seems since iTunes dramatically changed their software, we've been having issues with the mini being recognized when it's plugged into the computer. I have a regular iPod and the same cable works just fine for my iPod but when we plug the m
-
Customizing menu to remove arrow with use simple rendering
Hello! Im continuing the development of a site in Sharepoint 2013 site, we have a left bar menu that works well, but I need to remove or center the small black arrows that appear when an item has a submenu. I have UseSimpleRendering = true, If i disa