How to create mobile ready layouts in Vaadin? [duplicate] - java

This question already has answers here:
Vaadin - Responsive Columns
(3 answers)
Closed 3 years ago.
How do I go about creating a layout or page with vaadin that works on both mobile and desktop screens? When I put things side by side, I can't override the styling to make them appear above or below one another no matter how specific I make the CSS.
HorizontalLayout layout = new HorizontalLayout();
layout.addComponents(new Label("Test"), new Label("Test"));
layout.addStyleName("my-layout");

HorizontalLayout is not meant for responsive layouts. If you want to create responsive layouts and use CSS use Div instead. There's an example here https://vaadin.com/tutorials/vaadin-key-concepts

Related

Unable to access modal window , actions not working [duplicate]

This question already has answers here:
Unable to Move Out of ViewPort Pane - Selenium
(3 answers)
Closed 4 years ago.
I am trying to automate this website http://the-internet.herokuapp.com where i have to go to http://the-internet.herokuapp.com/exit_intent and hover out of viewport pane so that a modal window appears.
I am not sure how to do this , i tried actions assuming when i go to top right the modal window appears and hence trying to hover around that image but it isnt working.
here is actions code-
driver.get("http://the-internet.herokuapp.com/exit_intent");
Actions ACTION = new Actions(driver);
ACTION.moveToElement(driver.findElement(By.xpath("//a[#href='https://github.com/tourdedave/the-internet']/img"))).build().perform();
I am not sure how to do this , any help is higly appreciated.
This is the URL -http://the-internet.herokuapp.com/exit_intent.
I tried searching SO but unable to find appropriate solution.
You can use driver.switchTo().frame("modalframname");
Then your code .frame will switch u to that frame and u can perform a test on it.

Android overlay text on notification drawable [duplicate]

This question already has answers here:
How to display count of notifications in app launcher icon [duplicate]
(5 answers)
Closed 6 years ago.
Currently, the notifications within my app are working great but if there are multiple notifications, then the whole status bar will be filled with them. Instead, I am looking to have one notification and then update that notification with text in a circle overlaying the notification icon to show the number of items.
The image below is what I am trying to achieve:
How can I achieve this programatically? As I am assuming that this would be the 'small icon' in the Notification Builder yet the small icon only accepts int (a resource layout int). If this cannot be done with the 'small icon' how would I achieve this with the 'large icon' (bitmap) or even set the normal icon (large) as the app icon & the small icon as an incrementing number?
What you can do is to create a custom notification with a custom layout. That way you can control everything that will be present on the Notification in both normal and big view.
Please refer : https://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomNotification

Multiple swt buttons, same listener [duplicate]

This question already has an answer here:
Creating multiple identical text verify listeners in eclipse-rcp/swt
(1 answer)
Closed 8 years ago.
I have an application which I want to develop in SWT, and I was wondering if there is a possibility to use a single Selection Listener for multiple buttons. For example I have a menu bar which contains an "open" menu item, and I also have a toolbar where I have an open button, can I use the same listener for both? I would be glad to see just a simple example if there is a possibility, and an explanation if there is no possibility to do what's above.
In general it's possible ... your listener will have to check the event's source attribute to determine where the event was fired from.
If you're attaching the listener to different object's, you probably want to implement a generic Listener instead of an object specific listener.

Java Change Button Background Color [duplicate]

This question already has an answer here:
Java Swing button colors [duplicate]
(1 answer)
Closed 7 years ago.
I am using netbeans to create a desktop application, and I am trying to change the background color of a JButton, btn1 using the code
btn1.setBackground(Color.Red)
But this does not work. Instead of changing the fill color of the button, only the border color is changed. How can I change the background fill?
Thanks
See this related question and answer.
In particular, you can use setForeground() to change the color of a button's text, but the corresponding setBackground() doesn't read well on some platforms. Using a Border is one alternative; a colored panel, shown below, is another.
You can also try calling setOpaque(true) on your button.

Netbeans GUI builder - to show a panel over another panel [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
How can I stack/overlay jPanels in Java?
I want to create a panel over another so that after clicking next button from first panel second panel gets open above it in same frame.
How can I do this using Netbeans GUI builder?
What you really want is a CardLayout , Have a look at this : How to Use CardLayout.
If you are using the Matisse feature of Netbeans, which uses GroupLayout, you may have to write some code to overcome your problem.
While creating your GUI keep both the panels on top of each other, keep the default visibility of your 2nd panel as false. Then when the button is clicked, set the 1st panel's visibility to false and change the 2nd panel's visibility to true.

Categories

Resources