I have come across a stickler of a problem.
In the swing environment there is a function that is available TextArea in the AWT Components. However this is not present in either the JFace or the Swing environment.
has anybody come across a solution? Would I have to make my own Interface as a work around?
Thanks in advance
You can use the SWT Text control for simple single or multi-line text, or you can use StyledText if you want text with fonts and colors.
Related
I am creating a java swing application and I am badly need to get the flat GUI look like in windows 8 to my swing application. But I couldn't find it yet. Can you help me?
You can PROBABLY use the default look and feel of swing apps, undecorate everything, and for those icons; I would use buttons with internal panels, images, labels, etc. To get the scroll functionality you should use mouse listeners to detect scrolling and slide the ui accordingly.
I'm trying to use Ctrl+C, Ctrl+X and Ctrl+V as Swing JMenu shortcut using NetBeans Visual Designer in my app. All of other shortcuts work except these.
What's the problem?
Those Key Bindings are used by default for text components. So if focus is on a text component they will invoke the default Action for the text component.
If you need more help then post your SSCCE that demonstrates the problem.
It is pretty hard to guess what the problem is from your description, but let me guess: do you happen to have JTextArea on the same JFrame? It has some neat property called actionMap (setActionMap(), getActionMap()), which probably has these Accelerators registered.
When I design my GUI using swing, the Swing Control Buttons are grey and the text easily fits on them. However, when I run the program the buttons become partly blue and the text no longer fits on them. Why does my program look different in the Swing Design than at run-time?
Why does my program look different in the Swing Design than at run-time?
Probably has something to do with your Look and Feel.
However, when I run the program the buttons become partly blue and the text no longer fits on them.
Probably because you are not using layout managers. Layout managers will make sure components are displayed properlly, even when switching between LAF's.
I can't guess what tool you are using to create your GUI but you are doing something wrong with the tool. If you need more help then post your SSCCE that demonstrates the problem.
I suppose you're using some GUI builder. Netbeans gui builder displays preview with native LaF, while program runs with default Metal LaF, which has different margins for components and font size. Either change LaF in your program to the one that works best for your layout, or make your components larger.
I want to put a text editor in my java application.
The editor has to have basic formatting features like fonts, bold, color etc..
Ideally I'd like to just add the Text Editor as a component to a JFrame.
Is there any library for this?
I think this could be simply done using a JEditPane, but I don't want to
go through all the trouble of making an editor if I could just import one.
From this post on java.net: have a look at Ekit.
The secton from the Swing tutorial on Text Component Features has a quick example how this might be done.
You can't just plug in a component and expect it to work as an editor. You need to add toolbars and menu items for your font, bold color features etc. The editor kits provided by Swing support all these basic features.
You might want to look at SwingX (see the Java Web Start demo on the page), in particular the JXEditorPane component.
I'm creating a cross platform application using Swing and Netbeans (Group Layout). Is there a trick I am missing to help develop dialogs with say OK, Cancel buttons in the correct order for different platforms - specifically Windows (OK-Cancel) and Mac (Cancel-OK), rather like the JOptionPane does? I can derive my own class from JDialog with two buttons on it, and swap text and actions around - I just wondered if there is something 'out of the box' I've missed. (This is not a question about which way round buttons should be, or the use of verbs e.g. Save instead of Ok.)
MiGLayout supports this out of the box. Either use this layout manager, or look how it does its magic.
Eclipse SWT also provides platform-aware layouts.