Text and Image on SWT Button - image

Is there a way to have a SWT buuton with both image and text in a view? I have tried embedding Swings in SWT and the view looks exactly as I want, but when there is an operation going on, this view doesnot load till it gets over. This makes my perspective look unstable. Please help.

What OS are you using? On Windows XP/Vista/Windows 7, GTK+ and OSX you can just set the text and the image. E.g.
public class ButtonView extends ViewPart
{
private Button m_button;
public void createPartControl(Composite parent)
{
m_button = new Button(parent, SWT.NONE);
m_button.setText("My Button");
m_button.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
}
public void setFocus()
{
m_button.setFocus();
}
}

Related

gwt onMouseOver and onMouseOut on Firefox

I have an image. I plan to put a transparent popup with little icons on top of it when the mouse is over the image, and the popup is hidden when the mouse is outside of the image. It is just similar to youtube. For Microsoft Edge and Chrome, the onMouseOver and onMouseOut are just triggered and handled as expected. For Firefox, I find the definition of onMouseOver/onMouseOut are a bit different. I need to switch to another application by Alt Tab and come back to the browser to trigger the onMouseOver. Does anyone know how to solve this problem?
evtPic.addMouseOverHandler(new MouseOverHandler() {
#Override
public void onMouseOver(MouseOverEvent event) {
popupScreen.setPopupPosition(evtPic.getAbsoluteLeft(), evtPic.getAbsoluteTop());
if(!popupScreen.isShowing())
{
popupScreen.show();
}
}
});
evtPic.addMouseOutHandler(new MouseOutHandler() {
#Override
public void onMouseOut(MouseOutEvent event) {
if(popupScreen.isShowing())
{
popupScreen.hide();
}
}
});
Thanks

Xamarin Iconize IconTabbedPage Example

Can someone provide an example of how to use the IconTabbedPage in Iconize, preferably in Xaml? I have an IconTabbedPage with IconNavigation pages as children, all defined in Xaml. I then set the Icon property of the subpages by specifiying the font awesome name (“fa-home”). I tried to set the title as well, but neither of these will render the icon. I have search (a lot) for examples of the IconTabbedPage but couldn’t find any in Xaml. Additional bonus if you can provide an example of how to use the icons in a list cell context action.
Looking into #Niklas Code, you can create a tabbed page with a base class that inherits from IconTabbedPage , then your xaml will look like this.
<icon:IconTabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:icon="clr-namespace:Plugin.Iconize;assembly=Plugin.Iconize"
....
>
<icon:IconTabbedPage.Children>
<ContentPage Title="Build" Icon="md-build">
</ContentPage>
</icon:IconTabbedPage.Children>
I hope it will help somebody
I think you can take a look on Sample on GitHub
[\[assembly: XamlCompilation(XamlCompilationOptions.Compile)\]
namespace Iconize.FormsSample
{
public class App : Application
{
public App()
{
// The root page of your application
var tabbedPage = new IconTabbedPage { Title = "Iconize" };
foreach (var module in Plugin.Iconize.Iconize.Modules)
{
tabbedPage.Children.Add(new Page1
{
BindingContext = new ModuleWrapper(module),
Icon = module.Keys.FirstOrDefault()
});
}
MainPage = new IconNavigationPage(tabbedPage);
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}][1]

Show image in popup Vaadin

I use Vaadin 7. I want to display a full sized image in a popup. The popup does not contain any close button nor resize. Just an image that takes full size in a popup. Does anyone done that before ? Thanks.
Use standard PopupView with Content constructor.
PopupView c = new PopupView(new Content() {
#Override
public Component getPopupComponent() {
return new Image("caption", resource); //use any resource
}
#Override
public String getMinimizedValueAsHTML() {
return "displayedstring";
}
});
What do you mean by popup that does not contain any close or resize button?
You can use Vaadin's Window and disable the Close and Resize mechanism.
https://vaadin.com/book/vaadin7/-/page/layout.sub-window.html

LibGDX not showing images on Android

I'm having some issues with image rendering on Android. I can see the game correctly in my Desktop build and also in the Android Emulator but when it comes to a real Android device nothing is painted.
Objects are there because if I click on the button I can't see the action is performed, I can hear sounds and see BitmapFonts painted correctly.
The problem happens with images painted as textures with spritebatcher or Actors (Image for instance).
Any ideas? Thanks in advance.
In Assets Class:
public static void texturePacker(){
if(S.DEBUG){
Settings settings = new Settings();
settings.maxWidth = 16384;
settings.maxHeight = 16384;
settings.jpegQuality = (float) 0.7;
TexturePacker2.process(settings, "imgs/res", "imgs/packs","pack");
}
}
public static void loadGameAssets() {
//Cargo todas las texturas del menu
enemy_punch_static=atlas.findRegion("punch_static");
enemy_punch_punyo1=atlas.findRegion("punch_punyo1");
...
}
In a Screen implementing class:
...
Image countdown_go=new Image(Assets.countdown_go);
stage.addActor(countdown_go);
...
#Override
public void render(float delta) {
super.render();
Gdx.gl.glClear(Gdx.gl.GL_COLOR_BUFFER_BIT | Gdx.gl.GL_DEPTH_BUFFER_BIT);
Gdx.gl.glClearColor(0.18431f,0.647058f,0.878431f, 1);
stage.act(delta);
stage.draw();
}
You can't use 16kx16k textures on devices. You can query GL_MAX_TEXTURE on all the devices you want to support to see if you can get away with something like 2048x2048 but you might want to switch to 1024x1024 to play it safe.

BlackBerry - MainScreen with labels vertical scroll

I am trying to create a MainScreen with vertical scrolling. From what I've read in the documentation, MainScreen has a VerticalManager inside, so it should be possible to enable vertical scrolling only with proper construction, i.e:
super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);
This is not working for me, however. I am creating a screen, adding a couple of LabelFields and no scrollbar, no scrolling at all. I am testing on 8900, OS 5.0.
Here is the code I use:
public class ExampleScreen extends MainScreen {
public ExampleScreen() {
super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);
create();
}
private void add(String text) {
add(new LabelField(text));
}
private void create() {
add("line 0");
add("line 1");
...
etc
...
}
}
The question is am I doing something wrong? Is there a way to enable vertical scrolling with MainScreen or do I need to create a VerticalManager myself?
The LabelField(s) added to the screen should either be FOCUSABLE themselves, or you can add the following BETWEEN each of the label fields: add(new NullField(NullField.FOCUSABLE));

Resources