הלינקייה: מגזין חודשי למפתחים

רוצה לשמוע על כל האירועים, המדריכים, הקורסים והמאמרים שנכתבו החודש ?
הלינקייה הינו מגזין חופשי בעברית שמשאיר אותך בעניינים.
בלי ספאם. בלי שטויות. פעם בחודש אצלך בתיבה.

Java

Learning the Java Programming Language

Introduction

A short presentation in hebrew about the life cycle of programming

XML Schemas

Examples

<?xml version="1.0"?>

<Book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="/Users/ynonperek/src/java/android/XMLExamples1/book.xsd">

  <Title>Purple Cow</Title>
  <Author>Seth Goddin</Author>
  <Publisher>Portfolio Hardcover</Publisher>
  <Year>2003</Year>
  <Reviews>
    <Review>Great Book, Changed My Life</Review>
    <Review>Not so good, don't buy it</Review>
  </Reviews>

XSL Examples

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">
		
	<xsl:template match="/">
		<html>
			<body>
				<ul>
					<xsl:apply-templates></xsl:apply-templates>
				</ul>
			</body>
			
		</html>		
	</xsl:template>	
	
	<xsl:template match="address">
		<li><xsl:value-of select="name"></xsl:value-of></li>
	</xsl:template>
	
	
</xsl:stylesheet>
	

XML Schema Solutions

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

	<xs:element name="floor">
		<xs:complexType>
			<xs:simpleContent>
				<xs:extension base="xs:nonNegativeInteger">
					<xs:attribute name="decorated" use="optional"></xs:attribute>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>

	<xs:element name="room">
		<xs:complexType>
			<xs:sequence maxOccurs="unbounded">

Java2D Examples

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
 
import javax.swing.JFrame;
import javax.swing.JPanel;
 
 
public class MyFirstPainter extends JPanel {
 
	@Override
	public void paint(Graphics g) {
		Graphics2D g2 = (Graphics2D)g;
		g2.setColor(Color.blue);
		g2.fillRect(0, 0, this.getWidth(), this.getHeight());
 
		g2.setColor(Color.lightGray);
		g2.fillRect(10, 10, this.getWidth() - 20, this.getHeight() - 20);
 
		g2.setColor(Color.red);
 
		g2.drawString("Hello", 30, this.getHeight() / 2);

Facebook API Example

package controller;
 
import java.awt.event.ActionEvent;
import java.io.IOException;
 
import javax.swing.AbstractAction;
import javax.swing.JLabel;
import javax.swing.JTextField;
 
import model.FacebookModel;
 
public class SubmitAction extends AbstractAction {
	JTextField display;
	FacebookModel model;
	JLabel center;
 
	public SubmitAction(String text, JTextField display, FacebookModel model, JLabel center) {
		super(text);
 
		this.display = display;
		this.model = model;
		this.center = center;
	}
 

Calculator UI

package model;
 
public class Calculator {
	private float currentValue;
	private float tempValueHolder;
	private Operators currOperation = Operators.None;
	private boolean needsReset = false;
 
	public float getValue() {
		return this.currentValue;
	}
 
	public float getTempValue() {
		return this.tempValueHolder;
	}
 
	public void zero() {
		this.currentValue = 0;
		this.tempValueHolder = 0;
	}
 
	public void userClickedNumber(float num) {
		if ( needsReset ) {
			needsReset = false;
			tempValueHolder = num;

Swing UI Examples

import javax.swing.JFrame;
import javax.swing.JLabel;
 
 
public class MyFirstUI {
 
	public static void main(String [] args) {
		JFrame f = new JFrame("Hello World");
		f.setSize(300, 200);
		JLabel l = new JLabel("Hello World", JLabel.CENTER);
 
		f.add(l);
		f.setVisible(true);
	}
}
import javax.swing.JFrame;
import javax.swing.JLabel;
 
 
public class MySpecialHelloFrame extends JFrame {
	/**
	 * 
	 */

DB Lesson Examples

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
 
 
public class PeopleDBManager {
	public Connection getConnection() throws ClassNotFoundException, SQLException  {
		Class.forName("org.sqlite.JDBC");
	    Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
 
	    return conn;
	}
 

Pages

Subscribe to RSS - Java