Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Im pretty new to SWING and I tried my best but this is what is happening.
I have a interface that looks like this:
https://dl.dropboxusercontent.com/u/17524455/nodelete/1.jpg
From the main thread I call:
FrmMain.settextParticipants(5 + "");
FrmMain.setLaps(5 + "");
FrmMain.setRaceType("standard");
And that goes OK.
I Even manage to update the stoptime and time in the upper part of the GUI.
But as soon as I call (in the next line)
PnlRacers.PnlTransparents[0].setNameAndKartNr("01", "RACER");
My UI breaks like this:
https://dl.dropboxusercontent.com/u/17524455/nodelete/2.jpg
And the only thing that helps to fix the UI is, when I grab the window and move it around (to my second screen for example). That tells me that the "data" or "functions" are working well I guess... But the REDRAWING (or how to call it) is somehow ok for the first arguments and broken for the last class. After moving around it looks like this: https://dl.dropboxusercontent.com/u/17524455/nodelete/3.jpg
I read something about redraw() and validate() and I tried all on all places and on any element I was working with :(.
Maybe someone knows what the problem could be and if the source should be any help, here it is: https://dl.dropboxusercontent.com/u/17524455/nodelete/TEST.rar
Please help :) Im so lost ...
Have you tried calling repaint() to the content pane after the change you implemented?
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
Cheers, lads.
I am currently standing in front of a minor problem, but it really drives me insane, that I'm not able to fix it.
My very first mistake was to use my main-JFrame as main-class, as well.
You will see why this is (as far as I am able to judge) a problem later...
Now I am opening a new JFrame from my main-class-main-JFrame and I want to disable it as long as the new JFrame is opened.
I've already read much about using JDialog to do this, but I did not yet managed to find a solution without having to redesign my whole sub-JFrame.
Is there an easy way to just disable the mainJFrame as long as the subJFrame is opened?
Something like:
JFrame subframe = new GUI_subJFrame(<params>);
this.disable();
subframe.onClose(this.enable());
I know this is awful and not existent source code, but I wanted to make my thought clear, accurately.
I just changed the "subJFrame" from JFrame to JDialog and added the following line to the constructor:
this.setModalityType(DEFAULT_MODALITY_TYPE);
It works fine and is not as complicated as it seemed at first glance.
Thanks to everyone for their help.
Use frame.dispose(); to close the frame
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 11 months ago.
Improve this question
I'm trying to create a feature flag in my react project (I believe I have to add a feature flag in the appsettings.json file), the flag is to hide the features that are currently being developed as we don't want users to have those features when those are yet to be tested fully. So the current approach I have is to wrap the newly developed code with a condition like if(flag){new code} I'm sorry if the approach looks silly but that's all I can come up with as a rookie, so can you guys help with some feasible approach if possible?
So I've tried adding the if condition to an existing feature in the code base as the newly developed code is yet to be committed but it didn't work.
Based on your comment from three hours ago I was able to figure out what exactly you wanted to do.
So: already having the flag all there is to do is to use it. There are at least three ways you can do it:
make it hidden - i think MDN docs explain it well enough
make it transparent - this is what you did: setting opacity to 0
not render it at all
not rendering is achieved like this:
return (
<SomeParentComponent>
{EnableDivision &&
<Division/>
}
</SomeParentComponent>
)
It's not like one of them is better than others: they are all situational.
hidden element is rendered, and therefore has state and can be found in the DOM tree, but doesn't take any space
transparent is like hidden, but takes up space
not rendered on the other hand can't be found in the DOM tree, doesn't take any space, the funcion or class creating it is never run and therefore it also can't have any state
Hopefully this should dispel your doubts about how to do it.
Also if you ever needed use some flags in many different components in various places of your component tree take look at what React Context does.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am using four ProgressBars in my AndroidApp.
First of all I want them all to be empty, and when I update a Variable, I want one of the ProgressBars to get filled a bit. But only up to a "goal" that I want to set in beforehand. For example as soon as the Variable hits 1000, the ProgressBar should be filled and a message should pop up or something like that, when the variable is 500, it should be halfway filled and so on.
These are my problems, I think they might all be solved by knowing how to bind a ProgressBar to a variable? If so, please tell me how I can achieve that, else, please tell me how I can still get my plan done. THANK YOU!
You can set the progress bar max value to 1000 and then rather than set the variable to 500, set the progress value to 500.
Here an example of binding the progress bar is:
Can i databind a ProgressBar in Android?
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Bukkit's setData(data) and getData() are deprecated. But there's no replacement.
Bukkit/Spigot JavaDoc says this about setData():
Deprecated. Magic value
Why is that?
So far, the only way to do it is by using:
Block.setData(byte data);
So, you could do something like this:
myBlock.setData(2); // Set block data to 2
Although Block.setData() is deprecated, it still works, and will continue to work (deprecated methods in Bukkit are rarely removed, especially those for which there is no alternative).
I wish I could give a better answer, but that's the only thing that you can do, as of now.
The reason it is deprecated is because Minecraft is moving away from item IDs, and switching to item names, to make it easier to expand in the future. Where you used to have to run /give player 19, you are now supposed to run /give player minecraft:sponge (although the ID still works). The same thing is going to happen to data values, instead of giving someone 35:14, you now give them red wool.
To get rid of the warning given by using a deprecated method, put #SuppressWarnings("deprecation") above the deprecated method when you use it, or above the method in which it is used.
To set the type of the block, you could use:
Block.setType(Material type);
An example is:
myBlock.setType(Material.GOLD_BLOCK); // Set block to gold block
You could also use MaterialData, but no one really knows how to use it (as far as I know). It's one of the things included in the Bukkit API, but no one knows why.
The source of WorldEdit and most other big plugins look messy because they use a lot of interfaces. To the developers, it seems very organized, but to someone reading it, it looks very messy, unless you can actually visualize the hierarchy.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am.working. on a Netbeans Java project in JFrame form (a GUI application) where I want to move a JLabel into circular path. Can any tell or help to how to do that?
It sounds like you haven't done anything yet, and when that happens and you need to get started, then you should try to break the main problem into little steps, and then try to solve each little step one at a time, including looking at references for each of these steps such as using a Timer, doing animation, positioning components, etc...
So general recommendations:
Look up using a Swing Timer (or just click on link)
Use the Timer to drive your animation.
You can move a JLabel if the layout is null, but this is generally to be avoided.
Consider instead using a custom layout if you absolutely need to move a JComponent (the JLabel) along a prescribed path.
Or if you just want to move an image, then draw the image inside of a JPanel's paintComponent(...) method, setting its position with two int fields that are changed by the Timer. This JPanel of course will need to be displayed in your GUI. There are lots of examples on how to do this on this site, some written by me (for example), that simple searching can help you find.
But most important, take the first steps, do something, anything, that moves you forward with this project.
Then when you try this if it doesn't work, show your code and we'll be much better able to help.