I'm using sliding panels with my android app, but i need to get an event when the panel is up, is there a way listen to when it happens?
im using a sothree Sliding panel library
Looks like you are talking about umano/AndroidSlidingUpPanel. After briefly looking at the documentation/code you should be able to set a PanelSlideListener to your SlidingUpPanelLayout. They also provide a SimplePanelSlideListener which inserts no-ops for any functions you choose not to implement, which is probably what you will want to use.
For example inside of your Activity's onCreate you could do something like:
SlidingUpPanelLayout slidingPanel = (SlidingUpPanelLayout)findViewById(R.id.your_sliding_layout);
slidingPanel.setPanelSlideListener(new SimplePanelSlideListener() {
#Override
public void onPanelExpanded(View panel) {
// Insert your code here
}
});
Related
first i use JavaSE 1.7 -> The product i develop for is setting this standard. So i can not use the Functions of JavaFX8!
I developed a Custom Menu Item like this:
http://de.share-your-photo.com/7f2f7d74d8
There you can see some triangels! If the triangle shows to the right side i want to get a PopUp on the right hand side next to the Menu Item.
My Problem is that the popup should be dragable and it should not be possible that the PopUp leaves the Main Stage.
Could you please help me with this Problem? What kind of class should i use to develop the PopUp?
Maybe is it possible to make a PopUp Object Draggabel?
I solve the problem, by myself.
I added a container (VBox) to the popup and makes this one draggable!
With every new Koordinate, i set the x&y coordinates to the new position!
container.setOnMouseDragged(new EventHandler<MouseEvent>() {
#Override
public void handle(MouseEvent event) {
// TODO Auto-generated method stub
if(dragAct==true){
//DRAG HANDLING
}
}
});
I use one layout in few cases. But when I show this layout in the window (com.vaadin.ui.Window) I have to hide one button otherwise layout stays unchanged. So I would like to know is the window opened or not at the moment. Is the any way to figure that out?
with getWindows you get all the windows of an UI. and with isAttached you will find out, if it is attached to the session (in a state where the user should see it)
I don't fully understand your question, but maybe this helps:
public class MyLayout extends VerticalLayout {
private Button myButton; // set it in the constructor
#Override
public void setParent(HasComponents parent) {
super.setParent(parent);
myButton.setVisible(!(parent instanceof Window)); // or recursively if need
}
}
I have developed a custom component consist of a layout and two labels within it. This layout is draggable. The code is similar to this :
DragAndDropWrapper boxWrap= new DragAndDropWrapper(layout);
mainLayout.addComponent(boxWrap);
After that I have a RichTextArea that allows the layout to be dropped in it. With this code.
RichTextArea richText= new RichTextArea;
DragAndDropWrapper dndWrapper = new DragAndDropWrapper(richText);
dndWrapper.setDropHandler(new DropHandler() {
public void drop(DragAndDropEvent event) {
//Do whatever you want when something is dropped
}
//Criterio de aceptacion
public AcceptCriterion getAcceptCriterion() {
return AcceptAll.get();
}
});
The code works fine. But when I drop the layout within the RichTextArea y want to get the Text written in this area and add some text but the method richText.getValue() is not updated unless I change the focus to another component or tab out. I guess there is not being communication with the server side so the value is not updated. Is there any way to force a a focus change when mousedown on the layout? I tried with JavaScript but i dont know how to add a onmousedown="function()" attribute to the layout component. I also tried extending RichTextArea and implementing the MouseListener or something or a TextChangeListener, but nothing works.
Any clue? Thank you.
PS: The component cannot be different from a RichTextArea.
Have you set richText.setImmediate(true); ?
I am developing the network application in which I want to run my J2ME MIDP application in background without any GUI so that is any way to construct the application is such manner.
try this
set your current Display to null. so there will not be any form or alert running on the screen. But however your code will be running in the background.
Display display = Display.getDisplay(this); // here 'this' points to Midlet
display.setCurrent(null);
it easy just have a code of line on any event for example in the click of button
Display.getDisplay (this).setCurrent (null);
and return back the control via
Display.getDisplay (this).setCurrent (mycanvas);
Yes this code works Good,
display = Display.getDisplay(this);
public void startApp()
{
display.setCurrent(form);
}
public void pauseApp()
{
}
public void hide()
{
Display.getDisplay (this).setCurrent (null);
}
This is will work like, make a button can after clicking it call hide Function, or you call this hide function in constructor so it will hide itself when app start, can you keep unHide statement in appStart() so if you Tab the program then it will unHide app again.
NOTE: you said you are working on Network app, but some mobile will turn off the Internet Connection, when the Mobile screen Turn Off. please check this. and If you found any solution It will be Good to share here.
I have created a new DesktopApplication in Netbeans. When I start it, it shows the gui directly on the screen. How to hide it after startup?
Something like this:
DesktopApplication1.getApplication().getMainFrame().setVisible(false);
after the initComponents(); method doesn't work.
Is there a way to hide this window after starting up? (I only want to show it after clicking the tray-Icon of this application. Not after startup.)
Thanks.
This problem is reproduceable when you create a new DesktopApplication in Netbeans. I haven't changed the code (only added the line mentioned above.)
If you look at the source code for DesktopApplication1App, it says something like
//DesktopApplication1App.java
#Action public void startup(){
show(new DesktopApplication1View(this));
}
To fix this, just comment out the show() call, and replacing it with a dummy. For example:
//DesktopApplication1App.java
#Action public void startup(){
Object o = new DesktopApplication1View(this);
}
Later, if you want to set it to be visible, you can call this:
//DesktopApplication1View.java
DesktopApplication1App.getApplication().show(this);
// ----- OR -----
this.getFrame().setVisible(true);
whichever works for you.