Java Code Examples for org.jxmpp.jid.EntityFullJid#getLocalpart()

The following examples show how to use org.jxmpp.jid.EntityFullJid#getLocalpart() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TicTacToePlugin.java    From Spark with Apache License 2.0 6 votes vote down vote up
/**
    * Creates The TicTacToe Window and starts the Game
    * @param gop
    * @param opponentJID
    */
   private void createTTTWindow(GameOfferPacket gop, EntityFullJid opponentJID) {

Localpart name = opponentJID.getLocalpart();

// tictactoe versus ${name}
JFrame f = new JFrame(TTTRes.getString("ttt.window.title", TTTRes.getString("ttt.game.name"),name.toString() ));

f.setIconImage(buttonimg.getImage());
GamePanel gp = new GamePanel(SparkManager.getConnection(),
	gop.getGameID(), gop.isStartingPlayer(), opponentJID,f);
f.add(gp);
f.pack();
f.setLocationRelativeTo(SparkManager.getChatManager().getChatContainer());
f.setVisible(true);

   }
 
Example 2
Source File: JidCreateTest.java    From jxmpp with Apache License 2.0 5 votes vote down vote up
@Test
public void entityFullFromComplexTest() throws XmppStringprepException {
	EntityFullJid entityFullJid = JidCreate.entityFullFrom("foo@[email protected]/bar@baz");

	Domainpart domainpart = entityFullJid.getDomain();
	assertEquals(Domainpart.from("[email protected]"), domainpart);

	Localpart localpart = entityFullJid.getLocalpart();
	assertEquals(Localpart.from("foo"), localpart);

	Resourcepart resourcepart = entityFullJid.getResourcepart();
	assertEquals(Resourcepart.from("bar@baz"), resourcepart);
}
 
Example 3
Source File: JidCreateTest.java    From jxmpp with Apache License 2.0 5 votes vote down vote up
@Test
public void entityFullFromUnsecapedComplexTest() throws XmppStringprepException {
	EntityFullJid entityFullJid = JidCreate.entityFullFromUnescaped("foo@[email protected]/bar@baz");

	Domainpart domainpart = entityFullJid.getDomain();
	assertEquals(Domainpart.from("[email protected]"), domainpart);

	Localpart localpart = entityFullJid.getLocalpart();
	assertEquals(Localpart.from("foo"), localpart);

	Resourcepart resourcepart = entityFullJid.getResourcepart();
	assertEquals(Resourcepart.from("bar@baz"), resourcepart);
}
 
Example 4
Source File: PlayerDisplay.java    From Spark with Apache License 2.0 5 votes vote down vote up
public PlayerDisplay(Mark myself, EntityFullJid opponent) {

	_currentplayer = new JLabel(" | "+TTTRes.getString("ttt.display.current"));
	
	_currentplayer.setHorizontalTextPosition(JLabel.LEFT);
	
	setCurrentPlayer(Mark.X);
	setLayout(new FlowLayout(FlowLayout.CENTER));

	JLabel mylabel = new JLabel(TTTRes.getString("ttt.display.me"));
	mylabel.setIcon(new ImageIcon(myself.getImage().getImage()
		.getScaledInstance(16, 16, Image.SCALE_SMOOTH)));
	mylabel.setHorizontalTextPosition(JLabel.LEFT);

	Mark you;
	if (myself == Mark.X)
	    you = Mark.O;
	else
	    you = Mark.X;
	
	Localpart name = opponent.getLocalpart();
	JLabel yourlabel = new JLabel(" | "+name);
	yourlabel.setIcon(new ImageIcon(you.getImage().getImage()
		.getScaledInstance(16, 16, Image.SCALE_SMOOTH)));
	yourlabel.setHorizontalTextPosition(JLabel.LEFT);

	add(mylabel);
	add(yourlabel);
	add(_currentplayer);
    }