I'm working in the Design view of a Swing application and occassionally I see a small hazard warning symbol appear in the top corner of a component.
I assumed this was something to do with visibility overlap or similar but having adjusted things I can't match a guess against anything credible. Unfortunately it doesn't have a tool-tip and does not react to any mouse clicks.
Any ideas? Google does not seem to suggest anything either.
The NetBeans help topic, Java File and Object Node Icons, may help identify the icon in question. Tool tips on each icon indicate the relevant name. The one labeled error badge, for example, means "The file cannot be parsed."
It's a "free design" layout warning -- you put new component to panel/container without layout manager and need manually drag and resize it (e.g. attach it to container borders).
Related
I am in need of a java file system browser without all the buttons and fields. Does swing have any components that can do this ? If not are there any third party components that can help me with this ?
JFileChooser
What I am looking for
In hindsight the question is vague. The JList style view of the component is not exactly what I am looking for. I just need a file browser which will fire an event when user selects something. Whether it is a JList style browser or a tree style brower is secondary. I see there are ways I can code this myself, the reason for posting a question here is to see if there are components that do this already.
Pretty much yes, you can get the horizontal listing of the files. You will have to use the JList's horizontal wrap for layout orientation. More details about the same can be found here.
JFileChooser wont allow to hide the rest of the controls, as it will end up loosing the core functionality. You will have to make use of your own custom control using the link described above and do the file operations.
I am having some problems figuring out how to make the outlined red part in the screenshot below using Swing. It's a GUI issue. Specifically I'm doing a little project about TV Series and I don't know how to show the characters' name in a horizontal scrolling control.
Can anyone show me the extends JTabbedPane about my particular problem?
If I'm missing something please let me know.
Full screenshot: http://img138.imageshack.us/img138/5381/screenxk.png
You may be looking for JTabbedPane.SCROLL_TAB_LAYOUT, which provides platform-specific navigation controls:
If all the tabs do not fit within a single run the look and feel will provide a way to navigate to hidden tabs.
In contrast JTabbedPane.WRAP_TAB_LAYOUT provides a (default) wrapping policy:
The tab layout policy for wrapping tabs in multiple runs when all tabs will not fit within a single run.
See How to Use Tabbed Panes for examples.
I was going through this thread and I was wondering, if maybe we could use the scroll-bars to do that?
How to Use Scroll Panes describes how to do things using scroll bars. If I am making a terminal based application using Java for a Linux OS, then can't I use code that will move the terminal knob/scrollbar move down further? I mean, that is how even the BASH "clear" works, right? So, maybe this console-based Java app can move the console scroll down and pretend to clear the screen?
Now, my problem is that I am unable to find any class within this "Scroll Pane API" documentation that would help me do that. If anyone has worked with this API before can help me, it would be much appreciated!
..maybe we could use the scroll-bars to do that?
No. You cannot 'wrap the CLI in a JScrollPane (or add any JScrollBar instances)'. It is a native component that is outside the control (beyond textual output) of Java.
I want to make a transparent overlay for a foreign project to show live video. Sample of overlay is given in the image link below. In image you can see a overlay at right bottom corner showing face of a person, I also want to achieve same functionality using JMF to show face and then display the face in overlay using swing.
Sample Overley Imahe: http://www.ovostudios.com/images/vidsamsolo.jpg
Can someone help achieving this functionality?
If you're just starting the project and haven't actually got the JMF part up and running yet, then you might want to take a look at some alternatives before committing to it.
If you want to go ahead with Swing, to get the general overlay behaviour you want, you'll need to make use of Frame.setUndecorated() to turn off window borders and buttons, and Window.setAlwaysOnTop() to make sure the window stays on top of other windows. For the transparency, see this tutorial. However, I'm not sure whether transparency and video will work nicely together, so good luck!
You might also want to write a custom focus handler for the window so that it cannot be focused, although it is probably impossible for the overlay to be properly 'phantom' whereby clicks just pass through the overlay to the underlying desktop. That kind of behaviour might only be possible by using low-level graphics techniques i.e. by not creating a window at all, but by drawing directly onto the screen. That might require a native library.
I'm trying to create a java desktop application that holds desktop icons. The app will be a menu/panel that is invisible until you hover your cursor near the top of the screen, at which point the menu full of desktop icons will drop down. To add new icons to the menu one must simply drag icons from the desktop into the menu and they should snap to grid. As I am an intermediate level programmer but I havn't ever done a GUI app before in any language, I was wondering if someone could help me out, both with how to approach the problem and on the packages and methods I should be using. Also, I'm thinking of doing this with NetBeans unless you have any other suggestions.
Thanks,
Andrew
As an alternative to Chad's option, you could also do this by creating a frame and using Java's transparent window capability to make the frame transparent (or translucent, if you want a hint that it's there), and using mouse entered/exited events to return the frame to its normal "solid" opacity.
Personally I'd try this solution just because I'd rather use event-based notification than polling the mouse position, but I expect it's more work than the other alternative.
As to drag and drop, I haven't used it extensively enough in Java to give any solutions, but it's not immediately obvious (from a cursory internet search) of how to handle native desktop drag and drops. I'd suggest starting with some dnd tutorials within an application so that you really understand Java's drag and drop API and capabilities.
You can use java.awt.MouseInfo to get the location of the mouse at any point in time, even if you don't have any windows open.
So, you could start a java program, then in your main loop poll the mouse location. If it's in the 'top', then you can open a window.
You can use the easiest thing to do would be to use JButtons or JLabels with images to represent the desktop icons. Just load the image you want to use and stick that on as a label.
I'd start by going through swing tutorial and writing a few simple GUI programs to get the hang of it.
But the MouseInfo thing is what you need to tell when the mouse is at the top of the screen.