I am using JApplet embedded in HTML. How can I set an icon or logo to the title bar of JApplet, just like we set icons to JFrame using setIconImage?
An applet has no title bar, so that is not possible. You could always try to have the applet set an icon for the web page itself.
Related
I was reading through the article here about JTaskPane.
I want to add an image icon close to the expanding/collapsing icon, instead of the default icon on the left of the title ('Product' as shown in the below image).
I found that I can remove the default icon by passing null to the setIcon method.
JTaskPaneGroup ProductMenu = new JTaskPaneGroup();
ProductMenu.setTitle("Product");
ProductMenu.setIcon(null);
Any idea how I could add a new icon close to the expanding/collapsing icon as follows?
I want to change the toolbar color and status bar color but, I want to get the color from webpage that has loaded in webView, like chrome :
How to do that with java please?
I want to add scrollbar to my web app so I can see every components on my browser.
Red rectangle in picture below is Grid. Grid is placed inside class that extends VerticalLayout and implements View.
Green color shows my scrollbar which is added to HybridMenu instance.
HybridMenu root = HybridMenuBuilder.get()
.setContent(new VerticalLayout())
.setMenuComponent(EMenuComponents.LEFT_WITH_TOP)
.setConfig(menuConfig)
.build();
root.addStyleName("scrollpanel");
root.setSizeFull();
super.setContent(root); //class extends UI
scrollpanel definition in css:
.scrollpanel > div {
overflow: auto !important;
}
When I reduce height of browser window, menu bar is also being scrolled:
I tried to set scrollbar to VerticalLayout, but it seems like id didn't capture that grid was partly hidden. (I've setted everything in VerticalLayout to full size - How to add scrollbar to Vaadin layout)
//extends VerticalLayout implements View
private void init()
{
this.addStyleName("scrollpanel");
this.setSizeFull();
this.setMargin(false);
grid.setSizeFull();
this.addComponentsAndExpand(grid);
this.setExpandRatio(grid, 0.7f);
this.setComponentAlignment(grid, Alignment.TOP_LEFT);
}
Generally I found some not expected (at least for me) behaviour of components in VerticalLayout. They acts differently according to Layout root
(Example with VerticalLayout as root).
Questions:
How can I avoid hiding part of hybrid menu when scrolling?
Am I missing something about adding scroll panel to this VerticalLayout?
#Edit:
I found that this problem doesn't occurs if HybridMenu content is not fullSized or content is not set.
On the other hand scrollbars are not available without it.
So, creating HybridMenu the way that code below shows, solves problem with scrollpanels, but restores previous problem (layout type doesn't change anything).
AbsoluteLayout test = new AbsoluteLayout();
test.setSizeFull();
HybridMenu root = HybridMenuBuilder.get()
.setContent(test)
.setMenuComponent(EMenuComponents.LEFT_WITH_TOP)
.setConfig(menuConfig)
.build();
// TrayUtilitiesDemo is a call which is returning me tray icon create by current java process.
MyMenu.setLabel("MyMenu");
TrayUtilitiesDemo.addPopupMenu(MyMenu);
TrayIcon trayIcon = TrayUtilitiesDemo.getTrayIcon();
System.out.println("TrayIcons are: "+trayIcon);
when i am doing
trayIcon.getPopupMenu().countItems();
it is retrun only 1 menuitem. which is added by me that is MyMenu.
there are other 4 menuitems are there added by some other class which is creating this tray icon.
and not able to get the ActionListener also.
basically i want to right click on tray icon click and click on menuitem in PopupMenu added by other class(or by other process) for automation.
using windows 7 machine.
please help.
I use Vaadin 6.8.8. I'm trying to add action handler to panel (to get context menu). The panel takes all the place of the window, but I caused the browser context menu when i do mouse right button click.
public class MyPanel extends Panel {
public MyPanel() {
...
addActionHandler(new Action.Handler(){
...
});
setSizeFull();
}
}
What is wrong?
Those action related methods in Panel are for keyboard shorcuts. Only Tree, Table and TreeTable are the core components supporting context menu. To add a context menu to your panel, take a look at the ContextMenu add-on.