Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » User Interface example projects(newbie wants see about the graphic quality in dialogs)
User Interface example projects [message #1772851] Sun, 17 September 2017 15:51 Go to next message
Erhy More is currently offline Erhy MoreFriend
Messages: 7
Registered: September 2017
Junior Member
Hello,
I'm coming from Visual Studio and I'm familiar to learn from example projects.
I only succeed with HelloWorld in the Console window of Eclipse.

Please tell me, how to program a Dialog for Windows desktop or how to find example projects for.

Clicking New projects I don't know what to choose. It lists:
General
Gradle
Java
Maven
Plug-in Development
Team Logical Model Example
WindowBuilder
Examples

whereby in Examples is only the 'Editing and Validating XML files'

I installed Eclipse Oxygen Eclipse IDE for Java Developers 64 Bit,
Java SE Development Kit 8 Update 144 (64-bit)
and tried something more.

Thank You for advice
Erhy
Re: User Interface example projects [message #1772856 is a reply to message #1772851] Sun, 17 September 2017 17:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Try File -> New -> Project... -> Plug-in Project, choose a project name, accept the defaults on the first two pages, and use one of the templates. There are lots of tutorials you can Google for based on what you really want to develop...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: User Interface example projects [message #1772929 is a reply to message #1772856] Mon, 18 September 2017 20:17 Go to previous messageGo to next message
Erhy More is currently offline Erhy MoreFriend
Messages: 7
Registered: September 2017
Junior Member
Thank you Ed,
I choosed "Hello, World Command"
and got the error
https://sites.google.com/site/erhynutztphotoline/home/Validation_Problems_2.png

and a long error list, whereby I wondered about:
The platform metadata area could not be written: C:\Windows\System32\workspace\.metadata.

Thank you for further help
Erhy

[Updated on: Mon, 18 September 2017 20:18]

Report message to a moderator

Re: User Interface example projects [message #1772965 is a reply to message #1772929] Tue, 19 September 2017 14:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
That's an odd place to put your workspace. You likely don't have write permission there. Use File -> Switch Workspace and choose a folder where you definitely have write permission.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: User Interface example projects [message #1773053 is a reply to message #1772965] Wed, 20 September 2017 20:55 Go to previous messageGo to next message
Erhy More is currently offline Erhy MoreFriend
Messages: 7
Registered: September 2017
Junior Member
Thank you!
Last day I have uninstalled Eclipse and Java
and today reinstalled them.
Now I have no entries for Plug-in Project.
What I should install next to get this proposal in New Project?
Erhy
Re: User Interface example projects [message #1773067 is a reply to message #1773053] Thu, 21 September 2017 04:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
The entries are provided by PDE so you should install that via Help -> Install New Software, pick the release train repository and search for "Eclipse Plug-in Development Environment".

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: User Interface example projects [message #1773082 is a reply to message #1773067] Thu, 21 September 2017 09:27 Go to previous messageGo to next message
Erhy More is currently offline Erhy MoreFriend
Messages: 7
Registered: September 2017
Junior Member
Now I installed Eclipse PDE (Plug-in Development Environment) 3.10 Luna
What's next to program dialogs for Windows desktop?
Re: User Interface example projects [message #1773084 is a reply to message #1773082] Thu, 21 September 2017 09:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
There are useful Snippets for SWT (or JFace) depending on what overall type of GUI application you're trying to build: https://eclipse.org/swt/snippets/

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: User Interface example projects [message #1773108 is a reply to message #1773084] Thu, 21 September 2017 16:29 Go to previous messageGo to next message
Erhy More is currently offline Erhy MoreFriend
Messages: 7
Registered: September 2017
Junior Member
I copied the source HelloWorld SWT Snippets
got the errors:
package org.eclipse.swt.snippets;
The declared package "org.eclipse.swt.snippets" does not match the expected package ""

import org.eclipse.swt.widgets.*;
The import org.eclipse cannot be resolved

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Display cannot be resolved to a type
Display cannot be resolved to a type
Shell cannot be resolved to a type
Shell cannot be resolved to a type

Perhaps I have to install more ?
Re: User Interface example projects [message #1773111 is a reply to message #1773108] Thu, 21 September 2017 17:25 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
If you do not have it yet, please get <http://www.vogella.com/tutorials/SWT/article.html>, and read it. There are answers to most of your questions.

--

Tauno Voipio
Re: User Interface example projects [message #1773121 is a reply to message #1773111] Thu, 21 September 2017 21:14 Go to previous message
Erhy More is currently offline Erhy MoreFriend
Messages: 7
Registered: September 2017
Junior Member
Thank you so much!
This was the key for me.
My first rudimentary code:
package com.vogella.swt.widgets.layout;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class SWTLayoutPositionTracker {

	// TODO Auto-generated method stub
	static String newLine = System.getProperty("line.separator");
	private static Label positiongLabel;
	private static Shell shell;

	public static void main(String[] args) {
		Display display = new Display();
		shell = new Shell(display);

		positiongLabel = new Label(shell, SWT.BORDER);

		int x = 60;
		int y = 20;
		int width = 400;
		int height = 70;

		positiongLabel.setBounds(x, y, width, height);

		Font font = new Font(positiongLabel.getDisplay(), new FontData("Mono", 10, SWT.ITALIC));
		positiongLabel.setFont(font);
		positiongLabel.setToolTipText("This is the tooltip of this label");

		Button button = new Button(shell, SWT.PUSH);
		button.setBounds(x, y + height + 20, width, height);
		button.setText("press this button\n-results in output on console");
		// register listener for the button selection event
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				System.out.println("Button pressed!");
			}
		});

		int toolbarSize = 30;

		shell.setBounds(200, 400, width + 2 * x, height * 4 + y + toolbarSize);
		shell.open();

		shell.addMouseMoveListener(e -> showSize(e));
		positiongLabel.addMouseMoveListener(e -> showSize(e));

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}

	public static void showSize(MouseEvent e) {
		int x = e.x;
		int y = e.y;
		String s = "Bounds for Label: " + positiongLabel.getBounds() + newLine;
		s += "Bounds for Shell: " + shell.getBounds() + newLine;
		s += "Mouse pointer: " + x + " " + y;
		positiongLabel.setText(s);

	}
}
Previous Topic:Cannot Open Marketplace
Next Topic:TCF source code
Goto Forum:
  


Current Time: Fri Apr 26 05:59:14 GMT 2024

Powered by FUDForum. Page generated in 0.08885 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top