?

Log in

No account? Create an account

t3knomanser's Fustian Deposits

I'm going to stop programming now...

How Random Babbling Becomes Corporate Policy

run the fuck away

Mad science gone horribly, horribly wrong(or right).

I'm going to stop programming now...

Previous Entry Share Next Entry
run the fuck away
...but, I was documenting my code...


/**
   * 

JBuilder generated function. Initializes screen display elements.

* @throws java.lang.Exception There's no exception handling here. */ void jbInit() throws Exception { jLabelName.setText("Attribute: "); this.setLayout(xYLayout1); jLabelD.setText("d"); //Use the CyclingSpinnerListModel I found online. Should cite that. //Don't remember URL. //TODO: Fucking look it up cheezbal. SpinnerListModel s = new CyclingSpinnerListModel(Global.attrDieTypes); jSpinnerDieType = new JSpinner(s); jSpinnerDieType.addChangeListener(new Attrib_jSpinnerDieType_changeAdapter(this)); jSpinnerNumDice.addChangeListener(new Attrib_jSpinnerNumDice_changeAdapter(this)); this.setMaximumSize(new Dimension(140, 34)); jSpinnerNumDice.setBorder(BorderFactory.createLineBorder(Color.black)); jSpinnerNumDice.setMaximumSize(new Dimension(29, 22)); jSpinnerNumDice.setPreferredSize(new Dimension(29, 24)); jSpinnerDieType.setBorder(BorderFactory.createLineBorder(Color.black)); jSpinnerDieType.setMaximumSize(new Dimension(29, 22)); jSpinnerDieType.setPreferredSize(new Dimension(29, 24)); this.add(jLabelName, new XYConstraints(19, 11, -1, -1)); this.add(jSpinnerNumDice, new XYConstraints(79, 3, 50, 25)); this.add(jSpinnerDieType, new XYConstraints(149, 3, 50, 25)); this.add(jLabelD, new XYConstraints(136, 9, -1, -1)); } /** *

Using an attribute, set the values here. This function was supposed to * be more important than it ended up being. Goes to show.

* @param d The attribute being used. */ public void set(Attribute d) { jLabelName.setText(d.getName() + ":"); jSpinnerNumDice.setValue(new Integer(d.getNum())); jSpinnerDieType.setValue(new Integer(d.getType())); } /** *

Oh, here it gets interesting. Event handler for the DieType spinner. * Cycles between 0, 4, 6, and 8, the valid types for a COTS character. Will * add some method for allowing it to accept other ranges for races, but there's * no race logic as yet, so lump it.

* @param e */ void jSpinnerDieType_stateChanged(ChangeEvent e) { Integer i = (Integer)jSpinnerDieType.getValue(); int dieType = i.intValue(); /*if (dieType == 0) { jSpinnerDieType.setValue(jSpinnerDieType.getNextValue()); }*/ while (data.availableDieTypes(dieType) == 0) { jSpinnerDieType.setValue(jSpinnerDieType.getNextValue()); i = (Integer)jSpinnerDieType.getValue(); dieType = i.intValue(); /*if (dieType == 0) { jSpinnerDieType.setValue(jSpinnerDieType.getNextValue()); }*/ } try { data.assignDie(pos, dieType); } catch (InvalidDieType ex) { } } /** *

Don't let me document my code when I'm bitter at JBuilder. Why I'm using * this fucktarded program I'll never know... oh wait... because Eclipse's VE * doesn't work at all. This is an event handler for the NumDice spinner, * ranged 1-5.

* @param e */ void jSpinnerNumDice_stateChanged(ChangeEvent e) { if (initalized) { Integer i = (Integer) jSpinnerNumDice.getValue(); int newDie = i.intValue(); if (newDie > lastDieNum) { if (data.availableFreeAttributeDice() > 0) { data.spendFreeDie(pos); } else { data.spendFreebies(data.buyExtraDie(pos)); } } else { if (data.availableFreeAttributeDice() < Global.FREEDICE) { data.unspendFreeDie(pos); } else { data.spendFreebies(data.dropExtraDie(pos) * -1); } } lastDieNum = newDie; forceUpdate(); } } /** *

This fires the AttributeChange event to all of the listeners. Right now * this consists of frmMain. All that work for one listener. And, as I think * about it, using "Update" as the method name is fucktarded. But it was easy * to remember. My code, right? Fuck off

*/ protected void forceUpdate() { Object[] listenerList = listeners.toArray(); for (int i = 0; i < listenerList.length; i++) { AttributeChangeListener temp = (AttributeChangeListener)listenerList[i]; temp.update(); } }


No more coding for me.
  • Oh sweat bitterness. It's like using foul language while solving a quantum mechanical equation and having the solution make sense. Using variables like pfuck, and go_to_hell, and this_equation_really_sucks can be really therapeutic sometimes.
  • *fans self*

    geeks are hawt.
Powered by LiveJournal.com