Posts

Showing posts from April, 2017

Using Eclipse to create a model view presenter project in Java

Image
Some instructions on how to create a very simple Model View Presenter example in Java in the Eclipse development environment. A reference I found useful, from which I re-use all the code in this post: http://www.dreamincode.net/forums/topic/353210-swing-passive-model-view-presenter-in-5-minutes/ Step 1: Create a new Eclipse project In Eclipse select File > New > Java Project. Give your project a name and select the JRE execution environment. For this example I am using JRE-8: Step 2: Create the Model class Right-click the src folder in your Eclipse project. Select New > Class and name it 'Model': Model.java [code language="java"] public class Model { private String password; public Model() { password = "password"; } public void setPassword(String pass) { password = pass; } public String getPassword() { return password; } } [/code] Step 3:...

Creating a Windows application in Java using Eclipse

Image
Step 1: Create a new Java Application In Eclipse select File > New > Java Project: Step 2: Create a new Frame In Eclipse, right click the 'src' folder and select New > Other. In the wizard dialog that appears select WindowBuilder > Swing Designer > JFrame: Click Next. Give your JFrame a name: Click Finish. Note how the following code for gui.java gets generated: [code language="java"] import java.awt.BorderLayout; public class gui extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { gui frame = new gui(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public gui() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); conten...

Using the HTML Agility Package to modify web pages

Image
Step 1: Create a new Visual Studio project Create a new Console application: Step 2: Use the Package Manager console to install the HTML Agility package. Select Tools > NuGet Package Manager > Package Manager Consol Enter: Install-Package HtmlAgilityPack Step 3: Add the reference to the HtmlAgilityPack.dll Right click you References folder, and browse to the HtmlAgilityPack.dll file that gets installed to the 'packages' folder in your Visual Studio project. Select and add this file: Step 4: Try it on some examples 1. Insert the 'DOCTYPE' comment before the main tag and insert a "